import { useState } from "react"; import { useTranslation } from "react-i18next"; import { ArrowLeft, ShieldCheck, FolderLock, Loader2, CheckCircle2, Circle, } from "lucide-react"; interface StepConsentProps { /** PIN/password for PIN-protected profiles. Empty string if no PIN. */ password: string; onPasswordChange: (value: string) => void; /** True when the current profile is PIN-protected — hides the field otherwise. */ requiresPassword: boolean; /** Transition indicator: the running loader reuses this file via a flag. */ isRunning: boolean; /** Progress stage for the loader (0 = backup, 1 = verified, 2 = sql, 3 = done). */ runningStage: 0 | 1 | 2 | 3; onBack: () => void; onConfirm: () => void; } /** * Step 3 — Consent: an explicit checklist + confirm button, plus a loader * that takes over once the user clicks confirm. The loader shows the 4 sub- * steps (backup created, backup verified, SQL running, commit) per the mockup. */ export default function StepConsent({ password, onPasswordChange, requiresPassword, isRunning, runningStage, onBack, onConfirm, }: StepConsentProps) { const { t } = useTranslation(); const [ack1, setAck1] = useState(false); const [ack2, setAck2] = useState(false); const [ack3, setAck3] = useState(false); const allAck = ack1 && ack2 && ack3; const canConfirm = !isRunning && allAck && (!requiresPassword || password.trim().length > 0); if (isRunning) { return ; } return (

{t("categoriesSeed.migration.consent.title")}

{t("categoriesSeed.migration.consent.subtitle")}

{/* Backup info card */}

{t("categoriesSeed.migration.consent.backup.title")}

{t("categoriesSeed.migration.consent.backup.body")}

{t("categoriesSeed.migration.consent.backup.location")}

{/* Password field (only for PIN-protected profiles) */} {requiresPassword && (

{t("categoriesSeed.migration.consent.password.help")}

onPasswordChange(e.target.value)} className="w-full rounded-lg border border-[var(--border)] bg-[var(--background)] px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-[var(--primary)]/30" />
)} {/* Checklist */}

{t("categoriesSeed.migration.consent.checklist.title")}

{/* Nav */}
); } interface StageLineProps { done: boolean; active: boolean; label: string; } function StageLine({ done, active, label }: StageLineProps) { const icon = done ? ( ) : active ? ( ) : ( ); return (
  • {icon} {label}
  • ); } function RunningLoader({ stage }: { stage: 0 | 1 | 2 | 3 }) { const { t } = useTranslation(); return (

    {t("categoriesSeed.migration.running.title")}

    {t("categoriesSeed.migration.running.subtitle")}

      0} active={stage === 0} label={t("categoriesSeed.migration.running.step1")} /> 1} active={stage === 1} label={t("categoriesSeed.migration.running.step2")} /> 2} active={stage === 2} label={t("categoriesSeed.migration.running.step3")} /> 3} active={stage === 3} label={t("categoriesSeed.migration.running.step4")} />
    ); }