import { useTranslation } from "react-i18next"; import { cn } from "@/lib/utils"; import type { ConnectionStatus } from "@/lib/types"; const COPY: Record = { idle: { color: "text-muted-foreground" }, connecting: { color: "text-amber-700 dark:text-amber-300", }, open: { color: "text-emerald-700 dark:text-emerald-400", }, reconnecting: { color: "text-amber-700 dark:text-amber-300", }, closed: { color: "text-muted-foreground", }, error: { color: "text-destructive", }, }; export function ConnectionBadge({ status }: { status: ConnectionStatus }) { const { t } = useTranslation(); const meta = COPY[status]; const pulsing = status === "connecting" || status === "reconnecting" || status === "error"; const label = t(`connection.${status}`); return ( {pulsing && ( )} {label} ); }