import type { ConnectionMode } from '../hooks/useLiveMetrics'; interface ConnectionStatusProps { mode: ConnectionMode; lastUpdated: Date | null; error: string | null; } const labels: Record = { websocket: 'Live (WebSocket)', polling: 'Polling (10s)', connecting: 'Connecting…', offline: 'Offline', }; const dotClass: Record = { websocket: 'bg-emerald-400 shadow-emerald-400/50', polling: 'bg-amber-400 shadow-amber-400/50', connecting: 'bg-sky-400 animate-pulse', offline: 'bg-red-400', }; export function ConnectionStatus({ mode, lastUpdated, error }: ConnectionStatusProps) { return (
{labels[mode]} {lastUpdated && ( Updated {lastUpdated.toLocaleTimeString()} )} {error && {error}}
); }