import { useTranslation } from "react-i18next"; import { useImportWizard } from "../hooks/useImportWizard"; import ImportFolderConfig from "../components/import/ImportFolderConfig"; import SourceList from "../components/import/SourceList"; import SourceConfigPanel from "../components/import/SourceConfigPanel"; import FilePreviewTable from "../components/import/FilePreviewTable"; import DuplicateCheckPanel from "../components/import/DuplicateCheckPanel"; import ImportConfirmation from "../components/import/ImportConfirmation"; import ImportProgress from "../components/import/ImportProgress"; import ImportReportPanel from "../components/import/ImportReportPanel"; import WizardNavigation from "../components/import/WizardNavigation"; import ImportHistoryPanel from "../components/import/ImportHistoryPanel"; import { AlertCircle } from "lucide-react"; import { PageHelp } from "../components/shared/PageHelp"; export default function ImportPage() { const { t } = useTranslation(); const { state, browseFolder, refreshFolder, selectSource, updateConfig, toggleFile, selectAllFiles, parsePreview, checkDuplicates, executeImport, goToStep, reset, autoDetectConfig, toggleDuplicateRow, setSkipAllDuplicates, } = useImportWizard(); return (

{t("import.title")}

{/* Error banner */} {state.error && (

{state.error}

)} {/* Folder config - always visible */} {/* Wizard steps */} {state.step === "source-list" && ( <> )} {state.step === "source-config" && state.selectedSource && (
goToStep("source-list")} onNext={parsePreview} onCancel={reset} nextLabel={t("import.wizard.preview")} nextDisabled={ state.selectedFiles.length === 0 || !state.sourceConfig.name } />
)} {state.step === "file-preview" && (
{state.parsedPreview.length > 20 && (

{t("import.preview.moreRows", { count: state.parsedPreview.length - 20, })}

)} goToStep("source-config")} onNext={checkDuplicates} onCancel={reset} nextLabel={t("import.wizard.checkDuplicates")} nextDisabled={ state.parsedPreview.filter((r) => r.parsed).length === 0 } />
)} {state.step === "duplicate-check" && state.duplicateResult && (
setSkipAllDuplicates(true)} onIncludeAll={() => setSkipAllDuplicates(false)} /> goToStep("file-preview")} onNext={() => goToStep("confirm")} onCancel={reset} nextLabel={t("import.wizard.confirm")} />
)} {state.step === "confirm" && state.duplicateResult && (
goToStep("duplicate-check")} onNext={executeImport} onCancel={reset} nextLabel={t("import.wizard.import")} showCancel={false} />
)} {state.step === "importing" && ( )} {state.step === "report" && state.importReport && ( )}
); }