'use client' import { useEffect, useState } from 'react' import { cluster, nodes } from '@/lib/clusterMock' import { SlotMeter } from './SlotMeter' /** Fake liveness so the layout can be judged in motion. Replaced by SSE in Phase 2. */ function useDrift() { const [age, setAge] = useState(cluster.snapshotAge) const [slots, setSlots] = useState(3) useEffect(() => { const tick = setInterval(() => setAge((a) => (a > 6 ? 0.4 : +(a + 0.9).toFixed(1))), 900) const churn = setInterval(() => setSlots(() => 1 + Math.floor(Math.random() * 5)), 3400) return () => { clearInterval(tick) clearInterval(churn) } }, []) return { age, slots } } export function Ribbon() { const { age, slots } = useDrift() return (
{cluster.distro} k8s {cluster.kubernetes} nodes {nodes.length} snapshot {age.toFixed(1)}s seq {slots}/8 placeholder data
) }