From 8f4f6f5f0eece953ac054b1328770523c056825a Mon Sep 17 00:00:00 2001 From: Yuri Karamian Date: Sat, 21 Feb 2026 22:46:52 +0100 Subject: [PATCH] Scheduled backups, fixed settings/info panel sizing, added source mode shortcut, removed unused title mode setting --- src/lib/components/AppLayout.svelte | 35 ++++++++++++++++++++++++- src/lib/components/InfoPanel.svelte | 7 +++-- src/lib/components/SettingsPanel.svelte | 11 +++----- 3 files changed, 42 insertions(+), 11 deletions(-) diff --git a/src/lib/components/AppLayout.svelte b/src/lib/components/AppLayout.svelte index 95824f6..011fe0e 100644 --- a/src/lib/components/AppLayout.svelte +++ b/src/lib/components/AppLayout.svelte @@ -34,18 +34,46 @@ const appWindow = getCurrentWindow(); const isMac = navigator.platform.startsWith('Mac'); const isMobile = /android|ios/i.test(navigator.userAgent); - import { loadVaultState, saveVaultState, readNote, createDailyNote } from '$lib/api'; + import { loadVaultState, saveVaultState, readNote, createDailyNote, createBackup } from '$lib/api'; import { debounce } from '$lib/utils/debounce'; + import { get } from 'svelte/store'; import type { VaultState, FileEvent } from '$lib/types'; let sidebar: Sidebar; let noteList: NoteList; let editor: Editor; let unlistenFileChange: (() => void) | null = null; + let backupInterval: ReturnType | null = null; let navigatingFromHistory = false; let noteHistory: string[] = []; let noteHistoryIndex = -1; + function parseFrequencyMs(freq: string): number { + switch (freq) { + case '6h': return 6 * 60 * 60 * 1000; + case '12h': return 12 * 60 * 60 * 1000; + case '7d': return 7 * 24 * 60 * 60 * 1000; + case '24h': default: return 24 * 60 * 60 * 1000; + } + } + + async function checkScheduledBackup() { + const config = get(appConfig); + if (!config?.backup_enabled) return; + const interval = parseFrequencyMs(config.backup_frequency); + const last = config.last_backup_time ? new Date(config.last_backup_time).getTime() : 0; + if (Date.now() - last >= interval) { + const unlisten = await listen('backup-done', (event: any) => { + if (event.payload?.success) { + const cur = get(appConfig); + if (cur) appConfig.set({ ...cur, last_backup_time: new Date().toISOString() }); + } + unlisten(); + }); + try { await createBackup(); } catch (_) { unlisten(); } + } + } + // Track note navigation in history stack $effect(() => { const path = $activeNotePath; @@ -239,10 +267,15 @@ await sidebar?.refresh(); await noteList?.refresh(true); }); + + // Scheduled backup: check on startup and every 5 minutes + checkScheduledBackup(); + backupInterval = setInterval(checkScheduledBackup, 5 * 60 * 1000); }); onDestroy(() => { unlistenFileChange?.(); + if (backupInterval) clearInterval(backupInterval); }); diff --git a/src/lib/components/InfoPanel.svelte b/src/lib/components/InfoPanel.svelte index 005a90b..665009b 100644 --- a/src/lib/components/InfoPanel.svelte +++ b/src/lib/components/InfoPanel.svelte @@ -126,6 +126,7 @@
Redo{modKey}+Shift+Z
Go backAlt+
Go forwardAlt+
+
Toggle source mode{modKey}+Shift+M
Exit focus modeEsc

Editor Commands

@@ -164,7 +165,8 @@ border-radius: 16px; box-shadow: var(--shadow-lg); width: 500px; - max-height: 80vh; + height: 80vh; + max-height: 600px; overflow: hidden; display: flex; flex-direction: column; @@ -201,7 +203,7 @@ } .info-body { - padding: 0 24px 32px; + padding: 0 24px 16px; display: flex; flex-direction: column; align-items: center; @@ -244,6 +246,7 @@ } .info-logo { + margin-top: 12px; margin-bottom: 8px; } diff --git a/src/lib/components/SettingsPanel.svelte b/src/lib/components/SettingsPanel.svelte index d534a47..d30989c 100644 --- a/src/lib/components/SettingsPanel.svelte +++ b/src/lib/components/SettingsPanel.svelte @@ -612,13 +612,7 @@

Title

-
- - - -
- How the note title is displayed in the editor -