diff --git a/tools/ui/src/lib/components/app/navigation/SidebarNavigation/SidebarNavigation.svelte b/tools/ui/src/lib/components/app/navigation/SidebarNavigation/SidebarNavigation.svelte index fe503f53b..a23f4682e 100644 --- a/tools/ui/src/lib/components/app/navigation/SidebarNavigation/SidebarNavigation.svelte +++ b/tools/ui/src/lib/components/app/navigation/SidebarNavigation/SidebarNavigation.svelte @@ -27,7 +27,10 @@ let { onSearchClick = () => {} }: Props = $props(); - const { handleKeydown } = useKeyboardShortcuts({ activateSearchMode: () => onSearchClick() }); + const { handleKeydown } = useKeyboardShortcuts({ + activateSearchMode: () => onSearchClick(), + toggleSidebar: () => toggleExpandedMode() + }); let isExpandedMode = $state(false); let hoveredTooltip = $state(null); diff --git a/tools/ui/src/lib/enums/keyboard.enums.ts b/tools/ui/src/lib/enums/keyboard.enums.ts index 46cd4a776..735d3e4b4 100644 --- a/tools/ui/src/lib/enums/keyboard.enums.ts +++ b/tools/ui/src/lib/enums/keyboard.enums.ts @@ -9,6 +9,7 @@ export enum KeyboardKey { ARROW_LEFT = 'ArrowLeft', ARROW_RIGHT = 'ArrowRight', TAB = 'Tab', + B_LOWER = 'b', D_LOWER = 'd', D_UPPER = 'D', E_UPPER = 'E', diff --git a/tools/ui/src/lib/hooks/use-keyboard-shortcuts.svelte.ts b/tools/ui/src/lib/hooks/use-keyboard-shortcuts.svelte.ts index 05966a1a1..61df30b79 100644 --- a/tools/ui/src/lib/hooks/use-keyboard-shortcuts.svelte.ts +++ b/tools/ui/src/lib/hooks/use-keyboard-shortcuts.svelte.ts @@ -9,6 +9,7 @@ interface KeyboardShortcutsCallbacks { deleteActiveConversation?: () => void; navigateToPrevConversation?: () => void; navigateToNextConversation?: () => void; + toggleSidebar?: () => void; } export function useKeyboardShortcuts(callbacks: KeyboardShortcutsCallbacks) { @@ -21,6 +22,11 @@ export function useKeyboardShortcuts(callbacks: KeyboardShortcutsCallbacks) { callbacks.onSearchActivated?.(); } + if (isCmdOrCtrl && event.key === KeyboardKey.B_LOWER) { + event.preventDefault(); + callbacks.toggleSidebar?.(); + } + if ( isCmdOrCtrl && event.shiftKey &&