Add 'Show dates' setting to toggle the note-list date

This commit is contained in:
Yuri Karamian
2026-06-08 01:00:25 +02:00
parent a400eeefed
commit 6115ad4ab6
6 changed files with 25 additions and 4 deletions
+2
View File
@@ -225,6 +225,7 @@ export async function setGeneralSettings(
showTrayIcon: boolean,
closeToTray: boolean,
enableWikiLinks: boolean,
showNoteDates: boolean,
): Promise<void> {
return invoke("set_general_settings", {
compactNotes,
@@ -240,6 +241,7 @@ export async function setGeneralSettings(
showTrayIcon,
closeToTray,
enableWikiLinks,
showNoteDates,
});
}
+4 -3
View File
@@ -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<string | null>(null);
@@ -1111,7 +1112,7 @@
{#if getNotebookPath(note)}
<span class="note-notebook">{getNotebookPath(note)}</span>
{/if}
<span class="note-date-compact" title={`Created ${formatDate(note.meta.created)}\nModified ${formatDate(note.meta.modified)}`}>{formatRelativeTime($sortMode === 'created' ? note.meta.created : note.meta.modified)}</span>
{#if showDates}<span class="note-date-compact" title={`Created ${formatDate(note.meta.created)}\nModified ${formatDate(note.meta.modified)}`}>{formatRelativeTime($sortMode === 'created' ? note.meta.created : note.meta.modified)}</span>{/if}
</div>
{:else}
<div class="note-title" title={getNotebookPath(note) ? `${getNotebookPath(note)}/${note.meta.title}` : note.meta.title}>
@@ -1131,9 +1132,9 @@
<div class="note-meta">
{#if getNotebookPath(note)}
<span class="note-notebook">{getNotebookPath(note)}</span>
<span class="note-meta-sep">&middot;</span>
{#if showDates}<span class="note-meta-sep">&middot;</span>{/if}
{/if}
<span class="note-date" title={`Created ${formatDate(note.meta.created)}\nModified ${formatDate(note.meta.modified)}`}>{formatRelativeTime($sortMode === 'created' ? note.meta.created : note.meta.modified)}</span>
{#if showDates}<span class="note-date" title={`Created ${formatDate(note.meta.created)}\nModified ${formatDate(note.meta.modified)}`}>{formatRelativeTime($sortMode === 'created' ? note.meta.created : note.meta.modified)}</span>{/if}
{#if note.meta.tags.length > 0}
<span class="note-tags">
{#each note.meta.tags.slice(0, 3) as tag}
+13 -1
View File
@@ -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 @@
<span class="toggle-knob"></span>
</button>
</label>
<label class="setting-toggle">
<span class="setting-label">
<span class="setting-name">Show dates</span>
<span class="setting-desc">Show the date next to each note in the list</span>
</span>
<button class="toggle-switch" class:on={showNoteDates} onclick={() => { showNoteDates = !showNoteDates; saveGeneralSettings(); }}>
<span class="toggle-knob"></span>
</button>
</label>
</div>
<div class="settings-section">
+1
View File
@@ -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;