// Components import { Stack } from "@mui/material"; import InfraAreaChart from "./InfraAreaChart"; import SkeletonLayout from "./skeleton"; // Utils import { PercentTick, TzTick, InfrastructureTooltip, TemperatureTooltip, } from "../../../../../Components/Charts/Utils/chartUtils"; import { useTheme } from "@emotion/react"; import { useHardwareUtils } from "../../Hooks/useHardwareUtils"; const AreaChartBoxes = ({ shouldRender, monitor, dateRange }) => { const theme = useTheme(); const { buildTemps } = useHardwareUtils(); if (!shouldRender) { return ; } const { stats } = monitor ?? {}; const { checks } = stats; let latestCheck = checks[0]; const { temps, tempKeys } = buildTemps(checks); const configs = [ { type: "memory", data: checks, dataKeys: ["avgMemoryUsage"], heading: "Memory usage", strokeColor: theme.palette.accent.main, // CAIO_REVIEW gradientStartColor: theme.palette.accent.main, // CAIO_REVIEW yLabel: "Memory usage", yDomain: [0, 1], yTick: , xTick: , toolTip: ( ), }, { type: "cpu", data: checks, dataKeys: ["avgCpuUsage"], heading: "CPU usage", strokeColor: theme.palette.success.main, gradientStartColor: theme.palette.success.main, yLabel: "CPU usage", yDomain: [0, 1], yTick: , xTick: , toolTip: ( ), }, { type: "temperature", data: temps, dataKeys: tempKeys, strokeColor: theme.palette.error.main, gradientStartColor: theme.palette.error.main, heading: "CPU Temperature", yLabel: "Temperature", xTick: , yDomain: [ 0, Math.max(Math.max(...temps.flatMap((t) => tempKeys.map((k) => t[k]))) * 1.1, 200), ], toolTip: ( ), }, ...(latestCheck?.disks?.map((disk, idx) => ({ type: "disk", data: checks, diskIndex: idx, dataKeys: [`disks[${idx}].usagePercent`], heading: `Disk${idx} usage`, strokeColor: theme.palette.warning.main, gradientStartColor: theme.palette.warning.main, yLabel: "Disk Usage", yDomain: [0, 1], yTick: , xTick: , toolTip: ( ), })) || []), ]; return ( *": { flexBasis: `calc(50% - ${theme.spacing(8)})`, maxWidth: `calc(50% - ${theme.spacing(8)})`, }, }} > {configs.map((config) => ( ))} ); }; export default AreaChartBoxes;