From 70755a64eeb34a2f98f1e46aa73b817bdcbafcef Mon Sep 17 00:00:00 2001 From: tglide <26071571+TGlide@users.noreply.github.com> Date: Fri, 10 Mar 2023 20:03:16 +0000 Subject: [PATCH] feat: add keyboard shortcut --- src/lib/layout/navigation.svelte | 29 ++++++++++++++----- .../collection-[collection]/+layout.ts | 4 +-- ...ondSideNav.svelte => subNavigation.svelte} | 2 -- 3 files changed, 23 insertions(+), 12 deletions(-) rename src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/{secondSideNav.svelte => subNavigation.svelte} (98%) diff --git a/src/lib/layout/navigation.svelte b/src/lib/layout/navigation.svelte index dff034cfb..161300059 100644 --- a/src/lib/layout/navigation.svelte +++ b/src/lib/layout/navigation.svelte @@ -8,19 +8,29 @@ $: project = $page.params.project; $: projectPath = `${base}/console/project-${project}`; - $: secondSideNav = $page.data.secondSideNav; + $: subNavigation = $page.data.subNavigation; // We need to have this second variable, because we only want narrow // to change automatically if we change from having a second side nav to // not having one, not when the second side nav changes to a different value. - $: hasSecondSideNav = !!secondSideNav; + $: hasSubNavigation = !!subNavigation; let narrow = false; $: { - narrow = hasSecondSideNav; + narrow = hasSubNavigation; + } + + function handleKeyDown(event: KeyboardEvent) { + // If Alt + S is pressed + if (hasSubNavigation && event.altKey && event.key === 's') { + event.preventDefault(); + narrow = !narrow; + } } -
+ + +
{#if project}
@@ -130,11 +140,14 @@
{/if} - {#if secondSideNav} + {#if subNavigation}