import { ReactNode } from 'react'; const PALETTE = ['#2f5bea', '#e0702b', '#1b9e77', '#a14b9c', '#c9a227', '#d6336c', '#37a0d6']; const W = 640, H = 240, M = { l: 44, r: 12, t: 12, b: 32 }; const ts = (d: string) => new Date(d + 'T00:00:00Z').getTime(); const fmtMonth = (t: number) => new Date(t).toISOString().slice(0, 7); /** Papers per venue, placed on a time axis (venue start date). */ export function TimelineBars({ items }: { items: { label: string; date: string; n: number }[] }) { if (!items.length) return null; const xs = items.map((i) => ts(i.date)); const lo = Math.min(...xs) - 20 * 864e5, hi = Math.max(...xs) + 20 * 864e5; const max = Math.max(...items.map((i) => i.n)); const X = (t: number) => M.l + ((t - lo) / (hi - lo || 1)) * (W - M.l - M.r); const Y = (v: number) => H - M.b - (v / max) * (H - M.t - M.b); return ( ); } export interface ScorePoint { date: string; score: number; series: string; label: string; unit?: string | null } /** Scores over time, coloured by setting (finetuned / prompted / baseline / proposed). */ export function ScoreScatter({ points }: { points: ScorePoint[] }) { if (!points.length) return null; const series = Array.from(new Set(points.map((p) => p.series))); const xs = points.map((p) => ts(p.date)); const lo = Math.min(...xs) - 15 * 864e5, hi = Math.max(...xs) + 15 * 864e5; const ys = points.map((p) => p.score); const ymin = Math.min(0, ...ys), ymax = Math.max(...ys) * 1.05 || 1; const X = (t: number) => M.l + ((t - lo) / (hi - lo || 1)) * (W - M.l - M.r); const Y = (v: number) => H - M.b - ((v - ymin) / (ymax - ymin || 1)) * (H - M.t - M.b); const ticks = [ymin, (ymin + ymax) / 2, ymax]; return (