diff --git a/src/components/settings/SettingsSyncPanel.tsx b/src/components/settings/SettingsSyncPanel.tsx index 906c5f25..a21be236 100644 --- a/src/components/settings/SettingsSyncPanel.tsx +++ b/src/components/settings/SettingsSyncPanel.tsx @@ -649,6 +649,13 @@ function ActivityLog() { const { state, clearActivityLog } = useSettingsSync(); const [expanded, setExpanded] = createSignal(false); + // Reset expanded state when activity log is cleared + createEffect(() => { + if (state.activityLog.length === 0) { + setExpanded(false); + } + }); + const visibleEntries = createMemo(() => { return expanded() ? state.activityLog : state.activityLog.slice(0, 5); }); @@ -719,6 +726,8 @@ function ImportExportSection() { const [importing, setImporting] = createSignal(false); const [exporting, setExporting] = createSignal(false); const [importError, setImportError] = createSignal(null); + const [confirmImport, setConfirmImport] = createSignal(false); + const [pendingImport, setPendingImport] = createSignal(null); let fileInputRef: HTMLInputElement | undefined; @@ -749,20 +758,39 @@ function ImportExportSection() { const file = input.files?.[0]; if (!file) return; - setImporting(true); setImportError(null); try { const text = await file.text(); - await importSettings(text); + setPendingImport(text); + setConfirmImport(true); } catch (e) { setImportError(e instanceof Error ? e.message : String(e)); } finally { - setImporting(false); input.value = ""; } }; + const handleConfirmImport = async () => { + if (!pendingImport()) return; + + setImporting(true); + try { + await importSettings(pendingImport()!); + setConfirmImport(false); + setPendingImport(null); + } catch (e) { + setImportError(e instanceof Error ? e.message : String(e)); + } finally { + setImporting(false); + } + }; + + const handleCancelImport = () => { + setConfirmImport(false); + setPendingImport(null); + }; + return (
@@ -776,31 +804,65 @@ function ImportExportSection() { -
- - - -
+ + + + +
+ } + > +
+
+
+ Confirm Import +

+ This will overwrite your current sync-managed settings with the imported backup. + This action cannot be undone. +

+
+
+
+ + +
+
+
);