"use client"; import { useState } from "react"; import { Bar, BarChart, CartesianGrid, ResponsiveContainer, Tooltip, XAxis, YAxis, } from "recharts"; export interface TopicWer { topic: string; wer: number; } export interface TopicChartProps { data: TopicWer[]; } /** * Horizontal per-topic WER bar chart. Rendered only when a run actually * recorded a per-topic breakdown (platform-verified runs). * Colors tuned for the lifted palette: category labels in full text ink, * brighter accent bars. The one-shot bar draw-in is gated on * prefers-reduced-motion (recharts animation does not read the CSS override). */ export default function TopicChart({ data }: TopicChartProps) { /* lazy init: only meaningful client-side — ResponsiveContainer measures on mount anyway, so there is no server-rendered chart to mismatch */ const [animate] = useState( () => typeof window !== "undefined" && !window.matchMedia("(prefers-reduced-motion: reduce)").matches, ); return (