import { cn } from "@/lib/utils"; import { formatEastern } from "@/lib/time"; import type { StateResponse } from "../api"; interface Props { state: StateResponse | null; connected: boolean; generatedAt: string | null; } interface ChipDef { key: keyof StateResponse["summary"]; label: string; numCls: string; bgCls: string; } const CHIPS: ChipDef[] = [ { key: "active", label: "ACTIVE", numCls: "text-status-active", bgCls: "bg-status-active-bg", }, { key: "waiting", label: "AWAITING HUMAN", numCls: "text-status-waiting", bgCls: "bg-status-waiting-bg", }, { key: "parked", label: "PARKED", numCls: "text-status-parked", bgCls: "bg-status-parked-bg", }, { key: "open_questions", label: "OPEN QUESTIONS", numCls: "text-status-waiting", bgCls: "bg-status-waiting-bg", }, { key: "total", label: "TOTAL", numCls: "text-muted-foreground", bgCls: "bg-muted", }, ]; // Top status bar: brand, summary chips, connection health, and snapshot clock. export function TopBar({ state, connected, generatedAt }: Props) { const summary = state?.summary; const snapshot = formatEastern(generatedAt); const title = connected ? `Live — snapshot at ${snapshot}` : `Disconnected — last snapshot at ${snapshot}`; return (
{/* Brand */}
agent-team pipeline
{/* Divider */}
{/* Summary chips */}
{CHIPS.map((c) => (
{summary ? summary[c.key] : "–"} {c.label}
))}
{/* Health indicator */}
{snapshot}
); }