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} +
+