"use client"; import { HardDrive, Unplug } from "lucide-react"; import * as React from "react"; import { Label, Pie, PieChart } from "recharts"; import { ByteSize } from "~/client/components/bytes-size"; import { Card, CardContent, CardHeader, CardTitle } from "~/client/components/ui/card"; import { type ChartConfig, ChartContainer, ChartTooltip, ChartTooltipContent } from "~/client/components/ui/chart"; import type { StatFs } from "~/client/lib/types"; type Props = { statfs: StatFs; }; export function StorageChart({ statfs }: Props) { const chartData = React.useMemo( () => [ { name: "Used", value: statfs.used, fill: "#ff543a", }, { name: "Free", value: statfs.free, fill: "lightgray", }, ], [statfs], ); const chartConfig = {} satisfies ChartConfig; const usagePercentage = React.useMemo(() => { return Math.round((statfs.used / statfs.total) * 100); }, [statfs]); const isEmpty = !statfs.total; if (isEmpty) { return ( Storage Usage No storage data available. Mount the volume to see usage statistics. ); } return ( Storage Usage [, name]} /> } /> { if (viewBox && "cx" in viewBox && "cy" in viewBox) { return ( {usagePercentage}% Used ); } }} /> Total Capacity Used Space Free Space ); }
No storage data available. Mount the volume to see usage statistics.