import * as React from 'react' import { cn } from '../../lib/utils' import { HEALTH_TONE, type HealthStatus } from './health-status' /** A small solid status dot. Pair it with a label — never rely on color alone. */ export function HealthDot({ status, className }: { status: HealthStatus; className?: string }) { return ( ) } /** A tone pill: icon + label, used in a HealthCard header to name the roll-up state. */ export function HealthBadge({ status, label, className, }: { status: HealthStatus label?: string className?: string }) { const tone = HEALTH_TONE[status] const Icon = tone.Icon return ( {label ?? tone.label} ) } export interface HealthCardProps { /** Card heading. */ title: string /** The rolled-up tone — drives the left accent + the header badge. */ status: HealthStatus /** Optional short label overriding the tone's default badge text (e.g. "3 stale"). */ statusLabel?: string /** Optional leading icon for the title. */ icon?: React.ComponentType<{ className?: string }> /** Optional right-aligned header slot (a link, a period selector…). */ action?: React.ReactNode /** Body — the signal-specific content. */ children?: React.ReactNode /** Shown (muted, centered) when there is nothing to report. */ emptyMessage?: string /** Render the empty state instead of children. */ isEmpty?: boolean isLoading?: boolean className?: string } /** * The base surface every SystemHealth block renders into: a titled card with a * left tone-accent and a status badge, so a wall of them reads as a scannable * health board. Presentational only — the tone + contents are computed by the * composer (or, in a tenant app, by the dashboard widget that fetches the data). */ export function HealthCard({ title, status, statusLabel, icon: Icon, action, children, emptyMessage = 'Nothing to report.', isEmpty, isLoading, className, }: HealthCardProps) { return (
{emptyMessage}
) : ( children )}