"use client"; import { cn } from "@/lib/utils"; import { useI18n } from "@/i18n/i18n-context"; type BadgeStatus = "completed" | "pending" | "indexing" | "failed" | "deleting"; interface StatusBadgeProps { status: BadgeStatus; label?: string; } // Both `success` / `success-soft` (and friends) are registered in // tailwind.config.ts and back themselves with HSL CSS variables that // already swap inside the `.dark` selector in globals.css, so a single // utility class covers both themes. Adding a separate `dark:bg-*` // override here would actually clobber the soft token in dark mode. const STATUS_CLASS_MAP: Record = { completed: "bg-success-soft text-success", pending: "bg-warning-soft text-warning", indexing: "bg-info-soft text-info", failed: "bg-danger-soft text-danger", deleting: "bg-warning-soft text-warning", }; const FALLBACK_CLASS = "bg-muted text-muted-foreground"; export function StatusBadge({ status, label }: StatusBadgeProps) { const { t } = useI18n(); const statusClass = STATUS_CLASS_MAP[status] ?? FALLBACK_CLASS; const displayLabel = label ?? t(`status.${status}`); return ( {displayLabel} ); }