import { useTranslation } from "react-i18next"; import { CheckCircle, XCircle, AlertTriangle, Tag, FileText, } from "lucide-react"; import type { ImportReport } from "../../shared/types"; import { isRowErrorKey } from "../../utils/importFormat"; interface ImportReportPanelProps { report: ImportReport; onDone: () => void; } export default function ImportReportPanel({ report, onDone, }: ImportReportPanelProps) { const { t } = useTranslation(); const stats = [ { icon: FileText, label: t("import.report.totalRows"), value: report.totalRows, color: "text-[var(--foreground)]", }, { icon: CheckCircle, label: t("import.report.imported"), value: report.importedCount, color: "text-[var(--positive)]", }, { icon: AlertTriangle, label: t("import.report.skippedDuplicates"), value: report.skippedDuplicates, color: "text-[var(--accent)]", }, { icon: XCircle, label: t("import.report.errors"), value: report.errorCount, color: "text-[var(--negative)]", }, { icon: Tag, label: t("import.report.categorized"), value: report.categorizedCount, color: "text-[var(--primary)]", }, { icon: Tag, label: t("import.report.uncategorized"), value: report.uncategorizedCount, color: "text-[var(--muted-foreground)]", }, ]; return (
{stat.value}
| {t("import.report.row")} | {t("import.report.errorMessage")} |
|---|---|
| {err.rowIndex + 1} | {/* Row errors are i18n keys (#325); an exception message that reached this list is NOT one and stays verbatim. */} {isRowErrorKey(err.message) ? t(err.message) : err.message} |