import { cx, STATUS_LABEL } from "@/lib/format"; const TONE: Record = { REALTIME: "bg-positive-soft text-positive", DELAYED: "bg-warning-soft text-warning", END_OF_DAY: "bg-surface-3 text-ink-2", AT_CLOSE: "bg-surface-3 text-ink-2", INDICATIVE: "bg-surface-3 text-ink-2", STALE: "bg-stale-soft text-stale", WITHHELD: "bg-stale-soft text-stale", UNKNOWN: "bg-stale-soft text-stale", // connector / market states HEALTHY: "bg-positive-soft text-positive", DEGRADED: "bg-warning-soft text-warning", RECONNECTING: "bg-warning-soft text-warning", STARTING: "bg-warning-soft text-warning", FAILED: "bg-negative-soft text-negative", PAUSED: "bg-stale-soft text-stale", DISABLED: "bg-stale-soft text-stale", NONE: "bg-stale-soft text-stale", OPEN: "bg-positive-soft text-positive", PRE: "bg-warning-soft text-warning", POST: "bg-warning-soft text-warning", AUCTION: "bg-warning-soft text-warning", HALTED: "bg-negative-soft text-negative", CLOSED: "bg-surface-3 text-ink-2", operational: "bg-positive-soft text-positive", degraded: "bg-warning-soft text-warning", outage: "bg-negative-soft text-negative", unknown: "bg-stale-soft text-stale", // severities INFO: "bg-surface-3 text-ink-2", NOTICE: "bg-accent-soft text-accent", WARNING: "bg-warning-soft text-warning", CRITICAL: "bg-negative-soft text-negative", DEBUG: "bg-stale-soft text-stale", }; export function StatusBadge({ status, label, className, dot }: { status: string | null | undefined; label?: string; className?: string; dot?: boolean }) { const s = status ?? "UNKNOWN"; const text = label ?? STATUS_LABEL[s] ?? s.replace(/_/g, " ").toLowerCase(); return ( {dot && } {text} ); } /** Rights classification chip with a plain-language label. */ export const RIGHTS_LABEL: Record = { PUBLIC_OPEN: "Public", PUBLIC_ATTRIBUTED: "Public · attribution", PUBLIC_RESTRICTED_REDISTRIBUTION: "Restricted redistribution", OFFICIAL_OPEN_DATA: "Official open data", LICENSED: "Licensed", DELAYED: "Delayed · attribution", INDICATIVE: "Indicative", RESEARCH_ONLY: "Research only", INTERNAL_ONLY: "Internal only", UNKNOWN: "Unknown", DISABLED: "Disabled", }; export function RightsBadge({ status, className }: { status: string; className?: string }) { const restricted = ["PUBLIC_RESTRICTED_REDISTRIBUTION", "RESEARCH_ONLY", "INTERNAL_ONLY", "UNKNOWN", "DISABLED"].includes(status); return {RIGHTS_LABEL[status] ?? status}; }