import { BaseChart } from "@/components/monitors/Chart"; import { TrendingUp } from "lucide-react"; import { AreaChart, Area, Tooltip, CartesianGrid, ResponsiveContainer, } from "recharts"; import { HistogramPageSpeedScoresTooltip } from "./HistogramPageSpeedScoresTooltip"; import { useTheme } from "@mui/material/styles"; import type { GroupedCheck } from "@/types/check"; import type { Palette } from "@mui/material/styles"; type PaletteColorKey = Extract< keyof Palette, "primary" | "secondary" | "success" | "warning" | "accent" >; export interface ConfigItem { id: string; text: string; palette: PaletteColorKey; } const config: Record = { seo: { id: "seo", text: "SEO", palette: "secondary", }, performance: { id: "performance", text: "performance", palette: "success", }, bestPractices: { id: "bestPractices", text: "best practices", palette: "warning", }, accessibility: { id: "accessibility", text: "accessibility", palette: "accent", }, }; export const HistogramPageSpeedScores = ({ checks, }: { checks: GroupedCheck[]; }) => { const theme = useTheme(); return ( } title="Score history"> } /> {Object.values(config).map(({ id, palette }) => { const startColor = theme.palette[palette].main; const endColor = theme.palette[palette].lowContrast; return ( ); })} {Object.keys(config).map((key) => { const { palette } = config[key]; const strokeColor = theme.palette[palette].main; const bgColor = theme.palette.primary.main; return ( ); })} ); };