Add command-palette entries to reach hidden sidebar views (#153)

This commit is contained in:
Yuri Karamian
2026-06-22 13:20:15 +02:00
parent 4843bcacd5
commit 69330bf23c
2 changed files with 34 additions and 7 deletions
+1 -1
View File
@@ -967,7 +967,7 @@
{/if} {/if}
<SearchPanel /> <SearchPanel />
<CommandPalette /> <CommandPalette onNavigate={handleViewChanged} />
<SettingsPanel /> <SettingsPanel />
<InfoPanel /> <InfoPanel />
+33 -6
View File
@@ -3,6 +3,18 @@
import { setTheme, reindex } from '$lib/api'; import { setTheme, reindex } from '$lib/api';
import { darkThemes } from '$lib/platform'; import { darkThemes } from '$lib/platform';
// onNavigate runs the parent's view-change handler (refreshes the note list and reveals it
// if it was hidden), so opening a view here behaves exactly like clicking it in the sidebar.
let { onNavigate = () => {} }: { onNavigate?: () => void } = $props();
function openView(mode: 'all' | 'quickaccess' | 'tasks' | 'daily' | 'trash') {
$viewMode = mode;
$activeNotebook = null;
$activeTag = null;
$showCommandPalette = false;
onNavigate();
}
interface Command { interface Command {
id: string; id: string;
label: string; label: string;
@@ -26,15 +38,30 @@
$showSearch = true; $showSearch = true;
} }
}, },
{
id: 'open-all-notes',
label: 'Open All Notes',
action: () => openView('all')
},
{
id: 'open-quick-access',
label: 'Open Quick Access',
action: () => openView('quickaccess')
},
{
id: 'open-tasks',
label: 'Open Tasks',
action: () => openView('tasks')
},
{
id: 'open-daily',
label: 'Open Daily Notes',
action: () => openView('daily')
},
{ {
id: 'open-trash', id: 'open-trash',
label: 'Open Trash (restore deleted notes)', label: 'Open Trash (restore deleted notes)',
action: () => { action: () => openView('trash')
$viewMode = 'trash';
$activeNotebook = null;
$activeTag = null;
$showCommandPalette = false;
}
}, },
{ {
id: 'theme-light', id: 'theme-light',