From 0685428c900178310f384078dabac216f874d71f Mon Sep 17 00:00:00 2001 From: jake Date: Sat, 21 Mar 2026 15:20:42 +0000 Subject: [PATCH] feat(ui): add export section to SettingsPage with directory picker and format selection Export Your Data section with three buttons: Export Transcriptions (MD/TXT), Export Tasks (JSON/CSV), and Export to Obsidian. Each opens a directory picker and shows status on completion. Co-Authored-By: Claude Opus 4.6 (1M context) --- src/lib/pages/SettingsPage.svelte | 113 +++++++++++++++++++++++++++++- 1 file changed, 112 insertions(+), 1 deletion(-) diff --git a/src/lib/pages/SettingsPage.svelte b/src/lib/pages/SettingsPage.svelte index 02ba6d0..9f8bca0 100644 --- a/src/lib/pages/SettingsPage.svelte +++ b/src/lib/pages/SettingsPage.svelte @@ -10,7 +10,7 @@ import ZonePicker from "$lib/components/ZonePicker.svelte"; import AccessibilityControls from "$lib/components/AccessibilityControls.svelte"; import { getPreferences, updatePreferences } from "$lib/stores/preferences.svelte.js"; - import { Check, ChevronRight } from "lucide-svelte"; + import { Check, ChevronRight, Download } from "lucide-svelte"; import { open } from "@tauri-apps/plugin-dialog"; const prefs = getPreferences(); @@ -173,6 +173,37 @@ } } + // --- Export state --- + let exportTranscriptFormat = $state("md"); + let exportTaskFormat = $state("json"); + let exportStatus = $state(""); + let exporting = $state(""); + + async function doExport(type) { + try { + const folder = await open({ directory: true, title: "Select export folder" }); + if (!folder) return; + + exporting = type; + exportStatus = ""; + + if (type === "transcriptions") { + const count = await invoke("export_transcriptions", { directory: folder, format: exportTranscriptFormat }); + exportStatus = count === 0 ? "No transcriptions yet" : `Exported ${count} transcription${count === 1 ? "" : "s"} to ${folder}`; + } else if (type === "tasks") { + const path = await invoke("export_tasks", { directory: folder, format: exportTaskFormat }); + exportStatus = `Tasks exported to ${path}`; + } else if (type === "obsidian") { + const count = await invoke("export_to_obsidian", { directory: folder }); + exportStatus = count === 0 ? "Nothing to export yet" : `Exported ${count} file${count === 1 ? "" : "s"} to ${folder}`; + } + } catch (err) { + exportStatus = typeof err === "string" ? err : "Export failed"; + } finally { + exporting = ""; + } + } + // --- Profile management --- function createProfile() { if (!newProfileName.trim()) return; @@ -621,6 +652,86 @@ {/if} + +
+ + {#if openSection === 'export'} +
+

All your data stays yours. Export everything as plain text files.

+ +
+ +
+ + +
+ + +
+ + +
+ + +
+ + Markdown + wikilinks, both transcriptions and tasks +
+
+ + {#if exportStatus} +

+ {exportStatus} +

+ {/if} +
+ {/if} +
+