import { type ReactNode, useState } from 'react'
import { SERIES, ORDER } from '@/lib/chart'
import type { SystemId } from '@/lib/types'
/** One claim of the Evals story: a title that states it, one sentence of takeaway, the
* chart, and the numbers behind it as a table on demand (every chart has a table view:
* the dataviz relief rule, and the honest way to read exact values). */
export function Section({
id,
title,
takeaway,
children,
table,
}: {
id: string
title: string
takeaway: ReactNode
children: ReactNode
table?: ReactNode
}) {
const [showTable, setShowTable] = useState(false)
return (
{title}
{takeaway}
{children}
{table && (
{showTable &&
{table}
}
)}
)
}
/** The A / B / C legend: a colour swatch beside each name (identity never by colour
* alone; text stays in ink colours). */
export function Legend({ names }: { names: Record }) {
return (
{ORDER.map((s) => (
System {s.toUpperCase()} ยท {names[s]}
))}
)
}
/** A plain numbers table (the "Show the numbers" view). */
export function NumbersTable({ head, rows }: { head: string[]; rows: (string | number)[][] }) {
return (