ui: restore Ctrl+B sidebar toggle shortcut (#25307)
This commit is contained in:
+4
-1
@@ -27,7 +27,10 @@
|
|||||||
|
|
||||||
let { onSearchClick = () => {} }: Props = $props();
|
let { onSearchClick = () => {} }: Props = $props();
|
||||||
|
|
||||||
const { handleKeydown } = useKeyboardShortcuts({ activateSearchMode: () => onSearchClick() });
|
const { handleKeydown } = useKeyboardShortcuts({
|
||||||
|
activateSearchMode: () => onSearchClick(),
|
||||||
|
toggleSidebar: () => toggleExpandedMode()
|
||||||
|
});
|
||||||
|
|
||||||
let isExpandedMode = $state(false);
|
let isExpandedMode = $state(false);
|
||||||
let hoveredTooltip = $state<string | null>(null);
|
let hoveredTooltip = $state<string | null>(null);
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ export enum KeyboardKey {
|
|||||||
ARROW_LEFT = 'ArrowLeft',
|
ARROW_LEFT = 'ArrowLeft',
|
||||||
ARROW_RIGHT = 'ArrowRight',
|
ARROW_RIGHT = 'ArrowRight',
|
||||||
TAB = 'Tab',
|
TAB = 'Tab',
|
||||||
|
B_LOWER = 'b',
|
||||||
D_LOWER = 'd',
|
D_LOWER = 'd',
|
||||||
D_UPPER = 'D',
|
D_UPPER = 'D',
|
||||||
E_UPPER = 'E',
|
E_UPPER = 'E',
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ interface KeyboardShortcutsCallbacks {
|
|||||||
deleteActiveConversation?: () => void;
|
deleteActiveConversation?: () => void;
|
||||||
navigateToPrevConversation?: () => void;
|
navigateToPrevConversation?: () => void;
|
||||||
navigateToNextConversation?: () => void;
|
navigateToNextConversation?: () => void;
|
||||||
|
toggleSidebar?: () => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function useKeyboardShortcuts(callbacks: KeyboardShortcutsCallbacks) {
|
export function useKeyboardShortcuts(callbacks: KeyboardShortcutsCallbacks) {
|
||||||
@@ -21,6 +22,11 @@ export function useKeyboardShortcuts(callbacks: KeyboardShortcutsCallbacks) {
|
|||||||
callbacks.onSearchActivated?.();
|
callbacks.onSearchActivated?.();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isCmdOrCtrl && event.key === KeyboardKey.B_LOWER) {
|
||||||
|
event.preventDefault();
|
||||||
|
callbacks.toggleSidebar?.();
|
||||||
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
isCmdOrCtrl &&
|
isCmdOrCtrl &&
|
||||||
event.shiftKey &&
|
event.shiftKey &&
|
||||||
|
|||||||
Reference in New Issue
Block a user