diff --git a/src/components/ocr-badge.tsx b/src/components/ocr-badge.tsx new file mode 100644 index 0000000..07295bd --- /dev/null +++ b/src/components/ocr-badge.tsx @@ -0,0 +1,56 @@ +import { Badge } from "@/components/ui/badge"; +import type { OCRStatus } from "@/lib/api"; + +interface OcrBadgeProps { + status?: OCRStatus | null; +} + +/** + * OcrBadge renders a small status pill next to the mail-detail header, + * mirroring the verification badges. `disabled` and missing values render + * nothing, so the component is safe to drop in unconditionally. + */ +export function OcrBadge({ status }: OcrBadgeProps) { + if (!status || status === "disabled") return null; + + switch (status) { + case "done": + return ( + + OCR ✓ + + ); + case "failed": + return ( + + OCR ✗ + + ); + case "skipped": + return ( + + OCR n/a + + ); + case "pending": + return ( + + OCR … + + ); + default: + return null; + } +}