import { BaseChart } from "@/Components/design-elements"; import { TrendingUp } from "lucide-react"; import { XTick } from "@/Components/monitors/charts/XTick"; import { XAxis, AreaChart, Area, Tooltip, CartesianGrid, ResponsiveContainer, } from "recharts"; import { HistogramPageSpeedScoresTooltip } from "@/Components/monitors"; import { useTheme } from "@mui/material/styles"; import type { PageSpeedGroupedCheck } from "@/Types/Check"; import type { Palette } from "@mui/material/styles"; type PaletteColorKey = Extract< keyof Palette, "primary" | "error" | "success" | "warning" >; export interface ConfigItem { id: string; text: string; palette: PaletteColorKey; } const config: Record = { seo: { id: "seo", text: "SEO", palette: "primary", }, performance: { id: "performance", text: "performance", palette: "success", }, bestPractices: { id: "bestPractices", text: "best practices", palette: "warning", }, accessibility: { id: "accessibility", text: "accessibility", palette: "error", }, }; export const HistogramPageSpeedDetails = ({ checks, range, }: { checks: PageSpeedGroupedCheck[]; range: string; }) => { const theme = useTheme(); return ( } title="Score history" > ( )} /> } /> {Object.values(config).map(({ id, palette }) => { const startColor = theme.palette[palette].main; const endColor = theme.palette[palette].light; return ( ); })} {Object.keys(config).map((key) => { const { palette } = config[key]; const strokeColor = theme.palette[palette].main; const bgColor = theme.palette.primary.main; return ( ); })} ); };