import { useTranslation } from "react-i18next"; import { AlertCircle } from "lucide-react"; import type { ParsedRow } from "../../shared/types"; interface FilePreviewTableProps { rows: ParsedRow[]; } export default function FilePreviewTable({ rows, }: FilePreviewTableProps) { const { t } = useTranslation(); if (rows.length === 0) { return (
{t("import.preview.noData")}
); } const errorCount = rows.filter((r) => r.error).length; return (

{t("import.preview.title")}

{t("import.preview.rowCount", { count: rows.length })} {errorCount > 0 && ( {t("import.preview.errorCount", { count: errorCount })} )}
{rows.map((row) => ( ))}
# {t("import.preview.date")} {t("import.preview.description")} {t("import.preview.amount")} {t("import.preview.raw")}
{row.rowIndex + 1} {row.parsed?.date || ( {row.error || "—"} )} {row.parsed?.description || "—"} {row.parsed?.amount != null ? row.parsed.amount.toFixed(2) : "—"} {row.raw.join(" | ")}
); }