import { Box, getDefaultZIndex, Group, HoverCard, Progress, Stack, Text, UnstyledButton } from "@mantine/core"; import type { BeszelSystemRow } from "./types"; import { thresholdColor } from "./colors"; import { formatPercent, getProgressTrackSize } from "./format"; interface DiskUsageProps { system: BeszelSystemRow; fontSize: string; progressSize: "xs" | "sm"; valueMiw: number; valueGap?: number; } const mountLabel = (path: string) => path === "/" ? "ROOT" : (path.split("/").filter(Boolean).at(-1) ?? path).toUpperCase(); const severityColor = (value: number) => `var(--mantine-color-${thresholdColor(value)}-6)`; export const DiskUsage = ({ system, fontSize, progressSize, valueMiw, valueGap = 6 }: DiskUsageProps) => { const filesystems = Object.entries(system.extraFilesystems).filter(([path]) => path !== "/"); const trackSize = getProgressTrackSize(progressSize); const dotSize = progressSize === "xs" ? 2 : 3; const dotGap = 2; return ( {formatPercent(system.disk)} {filesystems.length > 0 ? ( {filesystems.map(([path, value]) => ( ))} ) : ( )} {[["/", system.disk] as const, ...filesystems].map(([path, value]) => ( {mountLabel(path)} {formatPercent(value)} ))} ); };