import { Loader2, Upload, X } from "lucide-react"; import { useState } from "react"; import { useTranslation } from "@/contexts/i18n-context"; import { useFileStore } from "@/stores/file-store"; interface ProgressCardProps { active: boolean; phase: "uploading" | "processing" | "complete"; label: string; stage?: string; percent: number; elapsed: number; } export function ProgressCard({ active, phase, label, stage, percent, elapsed }: ProgressCardProps) { const { t } = useTranslation(); const activeJobId = useFileStore((s) => s.activeJobId); const cancelCurrentJob = useFileStore((s) => s.cancelCurrentJob); const [canceling, setCanceling] = useState(false); if (!active) return null; const icon = phase === "uploading" ? ( ) : ( ); const sublabel = [stage, `${elapsed}s`].filter(Boolean).join(" ยท "); return (
{icon}
{label}
{sublabel}
{Math.round(percent)}%
{activeJobId && cancelCurrentJob && ( )}
); }