'use client'; import { useState } from 'react'; import { AnimatedNumber } from '@/components/ui/AnimatedNumber'; import { Sparkline } from '@/components/ui/primitives'; import { fmt, fmtDelta, fmtInt } from '@/lib/format'; import { useDegraded, useLive } from '@/lib/live'; import { levelById, pressureColor, trendArrow } from '@/lib/pressure'; import { Time } from '@/lib/time'; import type { GlobalPressure } from '@/lib/types'; import { ExplainPanel } from './ExplainPanel'; /** The instrument. SSR renders `initial`; afterwards the live slice drives it. Click → Explain (spec §44). */ export function Gauge({ initial }: { initial: GlobalPressure | null }) { const live = useLive((s) => s.global); const updates = useLive((s) => s.updates); const { degraded, frozenSince } = useDegraded(); const [open, setOpen] = useState(false); const g = live ?? initial; if (!g) { return (

Global Internet Pressure

—

The pressure API is unreachable. This is our failure, not an Internet event.

); } const color = pressureColor(g.level); const level = levelById(g.level); const dim = degraded ? 'opacity-50 saturate-50' : ''; return (
{/* faint radial glow tinted by the current level — the only gradient on the site */} ); }