// Replay Snapshot Health // Purpose: Defines the Replay Snapshot Health module and the local helpers/components used in this file. // Scope: Keeps behavior unchanged while isolating this concern into a clear, single-responsibility unit. import { roverNameChromeStyle } from '../../lib/roverColor.js'; export default function ReplaySnapshotHealth({ health, roster = [] }) { if (!health) return null; const replay = health.replay || { sources: [], readyCount: 0, totalCount: 0 }; const snapshots = health.snapshots || { rovers: [], rooms: [] }; const roverColorFor = (id) => roster.find((entry) => String(entry.id) === String(id))?.color || null; const replaySummary = `${replay.readyCount}/${replay.totalCount} sources ready`; const roverStale = snapshots.rovers.filter((entry) => entry.stale).length; const roomStale = snapshots.rooms.filter((entry) => entry.stale).length; return (
Health
Replay segments {replaySummary}
Rover snapshots {snapshots.rovers.length - roverStale}/{snapshots.rovers.length} ok
Room cameras {snapshots.rooms.length - roomStale}/{snapshots.rooms.length} ok
{replay.sources.map((source) => (
{source.label} {source.recentCount}/{source.neededCount}
))}
{snapshots.rovers.map((entry) => (
{entry.name} {entry.stale ? 'stale' : 'ok'}
))}
{snapshots.rooms.map((entry) => (
{entry.name} {entry.error ? 'error' : entry.stale ? 'stale' : 'ok'}
))}
); }