'use client'; import Link from 'next/link'; import { Bar, Delta, LevelBadge, PNum } from '@/components/ui/primitives'; import { fmt, fmtInt } from '@/lib/format'; import { useLive } from '@/lib/live'; import { pressureColor } from '@/lib/pressure'; import type { ComponentId, Region } from '@/lib/types'; const COLS: ComponentId[] = ['routing', 'latency', 'dns', 'availability', 'http_tls', 'path']; const SHORT: Record = { routing: 'Rout', latency: 'Lat', dns: 'DNS', availability: 'Avail', http_tls: 'HTTP', path: 'Path' }; export function RegionsTable({ initial }: { initial: Region[] | null }) { const live = useLive((s) => s.regions); const regions = [...(live ?? initial ?? [])].sort((a, b) => b.pressure - a.pressure); if (!regions.length) return

Regions unavailable.

; return (
{COLS.map((c) => ( ))} {regions.map((r) => ( {COLS.map((c) => { const v = r.components[c]; return ( ); })} ))}
Region Pressure Δ1h Level {SHORT[c]} Probes Targets Inc. Coverage
{r.name} {r.continent} {v == null ? '·' : fmt(v, 0)} {fmtInt(r.probes)} {fmtInt(r.targets)} {fmtInt(r.incidents)} {r.coverage_ok ? r.role : 'weak'} · {Math.round(r.confidence * 100)} %
); }