import { format } from "date-fns"; import { Area, AreaChart, CartesianGrid, Legend, ResponsiveContainer, Tooltip, YAxis, } from "recharts"; import type { DockerStatsJSON } from "./show"; interface Props { acummulativeData: DockerStatsJSON["disk"]; diskTotal: number; } export const DockerDiskChart = ({ acummulativeData, diskTotal }: Props) => { const transformedData = acummulativeData.map((item, index) => { return { time: item.time, name: `Point ${index + 1}`, usedGb: +item.value.diskUsage, totalGb: +item.value.diskTotal, freeGb: item.value.diskFree, }; }); return (
{`Date: ${format(new Date(payload[0].payload.time), "PPpp")}`}
{`Disk usage: ${payload[0].payload.usedGb} GB`}
{`Disk free: ${payload[0].payload.freeGb} GB`}
{`Total disk: ${payload[0].payload.totalGb} GB`}