import { format } from "date-fns"; import { Area, AreaChart, CartesianGrid, YAxis } from "recharts"; import { type ChartConfig, ChartContainer, ChartTooltip, ChartTooltipContent, } from "@/components/ui/chart"; import type { DockerStatsJSON } from "./show-free-container-monitoring"; interface Props { accumulativeData: DockerStatsJSON["disk"]; diskTotal: number; } const chartConfig = { usedGb: { label: "Used (GB)", color: "hsl(var(--chart-3))", }, } satisfies ChartConfig; export const DockerDiskChart = ({ accumulativeData, diskTotal }: Props) => { const transformedData = accumulativeData.map((item, index) => ({ time: item.time, name: `Point ${index + 1}`, usedGb: +item.value.diskUsage, totalGb: +item.value.diskTotal, })); return ( `${value} GB`} /> { const time = payload?.[0]?.payload?.time; return time ? format(new Date(time), "PPpp") : ""; }} formatter={(value) => { return [`${value} GB`, "Used"]; }} /> } /> ); };