"use client"; import { CheckCircle2, FileText, LoaderCircle, TriangleAlert, } from "lucide-react"; import { useTranslation } from "react-i18next"; import type { AttachmentProcessingItem, AttachmentProcessingPhase, } from "@/features/chat/selectors/attachment-processing"; function phaseLabel( phase: AttachmentProcessingPhase, t: (key: string) => string, ): string { switch (phase) { case "uploading": return t("Sending to DeepTutor"); case "received": return t("Uploaded to DeepTutor"); case "submitting": return t("Sending to document parser"); case "parsing": return t("Document parser is processing"); case "retrieving": return t("Retrieving parsed result"); case "completed": return t("Ready for this answer"); case "fallback": return t("Using local PDF text"); case "failed": return t("Document parsing failed"); } } function PhaseIcon({ phase }: { phase: AttachmentProcessingPhase }) { if (phase === "completed") { return ; } if (phase === "failed" || phase === "fallback") { return ; } return ( ); } export default function AttachmentProcessingStatus({ items, }: { items: AttachmentProcessingItem[]; }) { const { t } = useTranslation(); if (!items.length) return null; return (
{items.map((item) => { const hasDetails = (item.phase === "failed" || item.phase === "fallback") && item.detail; return (
{hasDetails ? (
{t("Failure details")}

{item.detail}

) : null}
); })}
); }