import { BAND_STYLE, bandTicks, classifyMetric, meterFraction, } from '../../lib/metricBands'; /** * One labelled metric. * * Optionally carries a quality meter: pass `metric` (a key in METRIC_BANDS) and * the numeric `raw` value. The meter is the answer to "2.72 — is that good?" — * a track showing where the value sits, ticks at the band edges, and the band * word. Colour never travels alone; the word is always rendered beside it. * * Every tile is the same size. Hierarchy comes from grouping and section * labels, not from shrinking one row — two sizes read as inconsistent rather * than as a deliberate ranking. */ export function StatTile({ label, value, valueClass = 'text-gray-100', sub, title, metric, raw, }: { label: string; value: string; valueClass?: string; sub?: string; /** Native tooltip — how the metric is defined. */ title?: string; /** Key into METRIC_BANDS; enables the quality meter. */ metric?: string; /** Numeric value the meter reads (the formatted `value` is display-only). */ raw?: number | null; }) { const band = metric ? classifyMetric(metric, raw) : null; const style = band ? BAND_STYLE[band] : null; return (

{label}

{value}

{style && metric && (
{/* Band edges — where "fair" becomes "good", and so on. */} {bandTicks(metric).map((t) => ( ))}

{style.label}

)} {sub &&

{sub}

}
); }