import React from "react"; import { ArrowDown, ArrowUp } from "lucide-react"; import { useI18n } from "../../application/i18n/I18nProvider"; import type { MonitorStats } from "../../domain/monitorRuntime"; import { formatMonitorRate } from "../../domain/monitorFormatting"; import { buildMonitorDiskListLayout, type MonitorDiskListLayout } from "../../domain/monitorDisks"; import { MonitorSystemDiskToggle } from "./MonitorSystemDiskToggle"; type DiskRates = { diskReadSpeed?: number | null; diskWriteSpeed?: number | null }; function Rates({ stats }: { stats?: DiskRates | null }) { const { t } = useI18n(); return <> {t("monitor.diskRead")} {formatMonitorRate(stats?.diskReadSpeed)} {t("monitor.diskWrite")} {formatMonitorRate(stats?.diskWriteSpeed)} >; } /** Same mount order and row height as the adjacent capacity column. */ export function MonitorDiskIo({ stats, listLayout, showSystemToggle = false, onToggleSystem }: { stats?: (Pick & DiskRates) | null; listLayout?: MonitorDiskListLayout; showSystemToggle?: boolean; onToggleSystem?: () => void; }) { const { t } = useI18n(); const layout = listLayout ?? buildMonitorDiskListLayout(stats); return ( {layout.rows.map((row, index) => { if (row.kind === "system") return showSystemToggle ? : ; const { disk } = row; return ( {disk.mountPoint} ); })} {t("monitor.diskIoTotal")} ); }