diff --git a/src-tauri/src/commands.rs b/src-tauri/src/commands.rs index 7d6811d..43d7d7d 100644 --- a/src-tauri/src/commands.rs +++ b/src-tauri/src/commands.rs @@ -830,9 +830,11 @@ pub fn set_general_settings( show_tray_icon: bool, close_to_tray: bool, enable_wiki_links: bool, + show_note_dates: bool, ) -> Result<(), String> { let mut config = state.config.lock().map_err(|e| e.to_string())?; config.compact_notes = compact_notes; + config.show_note_dates = show_note_dates; config.time_format = time_format; config.gpu_acceleration = gpu_acceleration; config.autostart = autostart; diff --git a/src-tauri/src/types.rs b/src-tauri/src/types.rs index 16eb587..186230b 100644 --- a/src-tauri/src/types.rs +++ b/src-tauri/src/types.rs @@ -73,6 +73,8 @@ pub struct AppConfig { pub ui_scale: Option, #[serde(default)] pub compact_notes: bool, + #[serde(default = "default_true")] + pub show_note_dates: bool, #[serde(default)] pub time_format: String, #[serde(default)] @@ -188,6 +190,7 @@ impl Default for AppConfig { line_height: None, ui_scale: None, compact_notes: false, + show_note_dates: true, time_format: "relative".to_string(), gpu_acceleration: true, autostart: false, diff --git a/src/lib/api.ts b/src/lib/api.ts index 69430f1..c23cf8b 100644 --- a/src/lib/api.ts +++ b/src/lib/api.ts @@ -225,6 +225,7 @@ export async function setGeneralSettings( showTrayIcon: boolean, closeToTray: boolean, enableWikiLinks: boolean, + showNoteDates: boolean, ): Promise { return invoke("set_general_settings", { compactNotes, @@ -240,6 +241,7 @@ export async function setGeneralSettings( showTrayIcon, closeToTray, enableWikiLinks, + showNoteDates, }); } diff --git a/src/lib/components/NoteList.svelte b/src/lib/components/NoteList.svelte index 8e6be0e..4ac4b98 100644 --- a/src/lib/components/NoteList.svelte +++ b/src/lib/components/NoteList.svelte @@ -132,6 +132,7 @@ } let compact = $derived($appConfig?.compact_notes ?? false); + let showDates = $derived($appConfig?.show_note_dates !== false); let contextMenu = $state<{ x: number; y: number; note: NoteEntry } | null>(null); let sortMenu = $state<{ x: number; y: number } | null>(null); let editingNote = $state(null); @@ -1111,7 +1112,7 @@ {#if getNotebookPath(note)} {getNotebookPath(note)} {/if} - {formatRelativeTime($sortMode === 'created' ? note.meta.created : note.meta.modified)} + {#if showDates}{formatRelativeTime($sortMode === 'created' ? note.meta.created : note.meta.modified)}{/if} {:else}
@@ -1131,9 +1132,9 @@
{#if getNotebookPath(note)} {getNotebookPath(note)} - · + {#if showDates}·{/if} {/if} - {formatRelativeTime($sortMode === 'created' ? note.meta.created : note.meta.modified)} + {#if showDates}{formatRelativeTime($sortMode === 'created' ? note.meta.created : note.meta.modified)}{/if} {#if note.meta.tags.length > 0} {#each note.meta.tags.slice(0, 3) as tag} diff --git a/src/lib/components/SettingsPanel.svelte b/src/lib/components/SettingsPanel.svelte index 7c79fcb..375ae0c 100644 --- a/src/lib/components/SettingsPanel.svelte +++ b/src/lib/components/SettingsPanel.svelte @@ -457,6 +457,7 @@ // General settings let compactNotes = $state($appConfig?.compact_notes ?? false); + let showNoteDates = $state($appConfig?.show_note_dates ?? true); let timeFormat = $state($appConfig?.time_format ?? 'relative'); let gpuAcceleration = $state($appConfig?.gpu_acceleration ?? true); let autostart = $state($appConfig?.autostart ?? false); @@ -512,6 +513,7 @@ function saveGeneralSettings() { if ($appConfig) { $appConfig.compact_notes = compactNotes; + $appConfig.show_note_dates = showNoteDates; $appConfig.time_format = timeFormat; $appConfig.gpu_acceleration = gpuAcceleration; $appConfig.autostart = autostart; @@ -525,7 +527,7 @@ $appConfig.close_to_tray = closeToTray; $appConfig.enable_wiki_links = enableWikiLinks; } - setGeneralSettings(compactNotes, timeFormat, gpuAcceleration, autostart, pdfPreview, pdfHeight, titleMode, hideTitleInBody, showLineNumbers, defaultViewMode, showTrayIcon, closeToTray, enableWikiLinks) + setGeneralSettings(compactNotes, timeFormat, gpuAcceleration, autostart, pdfPreview, pdfHeight, titleMode, hideTitleInBody, showLineNumbers, defaultViewMode, showTrayIcon, closeToTray, enableWikiLinks, showNoteDates) .catch((e) => console.error('Failed to save general settings:', e)); } @@ -646,6 +648,7 @@ // Sync general settings if ($appConfig) { compactNotes = $appConfig.compact_notes ?? false; + showNoteDates = $appConfig.show_note_dates ?? true; timeFormat = $appConfig.time_format ?? 'relative'; gpuAcceleration = $appConfig.gpu_acceleration ?? true; autostart = $appConfig.autostart ?? false; @@ -750,6 +753,15 @@ +
diff --git a/src/lib/types.ts b/src/lib/types.ts index cce9f39..6c23885 100644 --- a/src/lib/types.ts +++ b/src/lib/types.ts @@ -56,6 +56,7 @@ export interface AppConfig { line_height: number | null; ui_scale: number | null; compact_notes: boolean; + show_note_dates: boolean; time_format: string; gpu_acceleration: boolean; autostart: boolean;