import Link from 'next/link'; import type { IndexRow } from '@/lib/queries/indices'; import { fmtNum, cn, fmtPct, deltaClass } from '@/lib/format'; /** * Live tape (§163): a terminal-style ticker of the indices. Published indices show value + daily change; * indices still building show their constituent progress. Pauses on hover/focus; static under reduced motion. */ export function IndexTape({ indices, className }: { indices: IndexRow[]; className?: string }) { if (!indices.length) return null; const ordered = [...indices].sort((a, b) => Number(Boolean(b.latest)) - Number(Boolean(a.latest)) || (a.isFlagship ? -1 : 0) - (b.isFlagship ? -1 : 0)); const items = ordered.map((i) => { const up = (i.change1d ?? 0) > 0; const down = (i.change1d ?? 0) < 0; return ( {i.ticker} {i.latest ? ( <> {fmtNum(i.latest.value, { digits: 2 })} {up ? '▲' : down ? '▼' : '■'} {fmtPct(i.change1d)} ) : ( building {i.pricedAssets}/{i.minConstituents} )} ); }); return (
{items} {items.map((it, k) => ( {it} ))}
); }