import Link from "next/link"; import { Sparkline } from "@/components/ui/sparkline"; import { cx, formatDuration } from "@/lib/format"; import type { DataHealth } from "@/lib/types"; /** Compact source-health panel for the homepage (server component; data from /v1/data-health). */ export function HealthPanel({ health, className }: { health: DataHealth; className?: string }) { const c = health.connectors; const ratio = health.healthy_ratio == null ? null : Math.round(health.healthy_ratio * 100); const segs: Array<[number, string, string]> = [ [c.healthy, "bg-positive", "healthy"], [c.degraded, "bg-warning", "degraded"], [c.recovering, "bg-accent", "recovering"], [c.failed, "bg-negative", "failed"], [c.paused, "bg-stale", "paused"], ]; return (

Source health

Data health โ†’
{ratio == null ? "โ€”" : `${ratio}%`} connectors healthy
{segs.map(([n, cls, label]) => (n > 0 ? : null))}
{segs.map(([n, cls, label]) => ( {n} {label} ))}
{health.history.length > 2 && (
48 h ยท healthy ratio h.healthy_ratio)} width={140} height={24} stroke="var(--accent)" />
)}
); } function Row({ k, v }: { k: string; v: string }) { return (
{k}
{v}
); }