"use client";
import { useMemo } from "react";
import { Area, AreaChart, YAxis } from "recharts";
import { scaleSymlog } from "d3-scale";
import { ChartContainer, type ChartConfig } from "../ui/chart";
import { ChartMessage } from "./ChartMessage";
import type { HomepageSummary } from "../../lib/homepageSummary";
import {
SYMLOG_CONSTANT,
compactNumber,
symlogTicks,
type ChartState,
} from "../../lib/homepageChart";
import { buildTimeSeries, type ChartSeries } from "../../lib/homepageChartData";
// One mini-panel per series, each on its OWN y-scale — so the outlier can't
// crush the others by construction (the honest per-shape comparison). With three
// sites this is a clean 3-up; the panel scale follows the chart's linear/symlog.
export function SmallMultiples({
summary,
state,
}: {
summary: HomepageSummary;
state: ChartState;
}) {
const { labels, series } = useMemo(
() => buildTimeSeries(summary, state),
[summary, state],
);
if (series.length === 0) {
return