import Link from 'next/link'; import { IncidentRow, TYPE_LABEL } from '@/components/incidents/IncidentRow'; import { Empty, PNum, Section } from '@/components/ui/primitives'; import { MONTH_NAMES, fmt, fmtInt } from '@/lib/format'; import { pressureColor } from '@/lib/pressure'; import type { HistoryDay, HistoryMonthRow, HistorySummary, Incident } from '@/lib/types'; /** Calendar heat strip: one cell per day coloured by max pressure. */ export function DayStrip({ days, year, month }: { days: HistoryDay[]; year: number; month: number }) { const dim = new Date(Date.UTC(year, month, 0)).getUTCDate(); const byDate = new Map(days.map((d) => [d.date, d])); const firstDow = (new Date(Date.UTC(year, month - 1, 1)).getUTCDay() + 6) % 7; // Monday first return (
{['M', 'T', 'W', 'T', 'F', 'S', 'S'].map((d, i) => ( {d} ))}
{Array.from({ length: firstDow }).map((_, i) => ( ))} {Array.from({ length: dim }, (_, i) => i + 1).map((n) => { const date = `${year}-${String(month).padStart(2, '0')}-${String(n).padStart(2, '0')}`; const d = byDate.get(date); return (
{n} {d && d.events > 0 && {d.events}}
{d && (
{fmt(d.max, 0)}
)}
); })}

Cell number = daily max pressure · red count = events opened that day · grey = not observed (observatory started 2026-09)

); } export function MonthStrip({ months }: { months: HistoryMonthRow[] }) { if (!months.length) return No month observed yet.; return ( ); } export function LargestGrid({ largest }: { largest: HistorySummary['largest'] }) { const cats: [keyof HistorySummary['largest'], string][] = [ ['pressure', 'Largest by pressure'], ['routing', 'Largest routing event'], ['dns', 'Largest DNS event'], ['latency', 'Largest latency event'], ]; return ( ); } export function TopLists({ s }: { s: HistorySummary }) { return (
{s.top_asns.length ? ( {s.top_asns.map((a) => ( ))}
ASN Events Max pressure
AS{a.asn} {a.name} {fmtInt(a.events)}
) : ( )}
{s.top_regions.length ? ( {s.top_regions.map((r) => ( ))}
Region Events Max Hours elevated
{r.name} {fmtInt(r.events)} {fmt(r.hours_elevated)}
) : ( )}
); } export function TopEvents({ events }: { events: Incident[] }) { if (!events.length) return No event in this range.; return ( ); }