import type { DashboardStats } from "@dci/core"; import Link from "next/link"; import { cn } from "@/components/ui/cn"; import { fmtInt, fmtPct, splitMw } from "@/lib/format"; import { routes } from "@/lib/routes"; interface Cell { label: string; value: string | null; unit?: string; caveat: string; href: string; accent?: boolean; } /** * Global ticker (§16): FACILITIES · KNOWN OPERATIONAL CAPACITY · UNDER CONSTRUCTION · PROJECTS · COUNTRIES · NEW EVENTS 24 H. * Every figure carries its coverage caveat on the line below — totals are lower bounds computed from published figures. */ export function GlobalTicker({ stats, className }: { stats: DashboardStats | null; className?: string }) { const s = stats; const op = splitMw(s?.knownOperationalMw); const uc = splitMw(s?.constructionMw); const cells: Cell[] = [ { label: "Facilities", value: s ? fmtInt(s.facilities) : null, caveat: s ? `${fmtInt(s.operational)} operational · ${fmtInt(s.metros)} markets` : "indexed records", href: routes.datacenters() }, { label: "Known operational capacity", value: op?.value ?? null, unit: op?.unit ?? "MW", caveat: s ? `MW published for ${fmtPct(s.mwCoverage)} of facilities — lower bound` : "published figures only", href: routes.datacenters("has_mw=1&status=operational&sort=mw") }, { label: "Under construction", value: uc?.value ?? null, unit: uc?.unit ?? "MW", caveat: s ? `${fmtInt(s.underConstruction)} facilities · published MW only` : "published MW only", href: routes.datacenters("status=under_construction"), accent: true }, { label: "Projects", value: s ? fmtInt(s.projects) : null, caveat: s ? `${fmtInt(s.planned)} planned facilities` : "pipeline records", href: routes.projects() }, { label: "Countries", value: s ? fmtInt(s.countries) : null, caveat: s ? `${fmtInt(s.operators)} operators` : "with ≥ 1 indexed facility", href: routes.countries() }, { label: "New events · 24 h", value: s ? fmtInt(s.events24h) : null, caveat: s ? `${fmtInt(s.events7d)} in 7 days · deduplicated` : "detected changes", href: routes.live(), accent: true }, ]; return (