diff --git a/web/containers/Providers/KeyListener.tsx b/web/containers/Providers/KeyListener.tsx index 36d513016..2731846df 100644 --- a/web/containers/Providers/KeyListener.tsx +++ b/web/containers/Providers/KeyListener.tsx @@ -8,7 +8,11 @@ import { MainViewState } from '@/constants/screens' import { useCreateNewThread } from '@/hooks/useCreateNewThread' -import { mainViewStateAtom, showLeftPanelAtom } from '@/helpers/atoms/App.atom' +import { + mainViewStateAtom, + showLeftPanelAtom, + showRightPanelAtom, +} from '@/helpers/atoms/App.atom' import { assistantsAtom } from '@/helpers/atoms/Assistant.atom' type Props = { @@ -17,6 +21,7 @@ type Props = { export default function KeyListener({ children }: Props) { const setShowLeftPanel = useSetAtom(showLeftPanelAtom) + const setShowRightPanel = useSetAtom(showRightPanelAtom) const setMainViewState = useSetAtom(mainViewStateAtom) const { requestCreateNewThread } = useCreateNewThread() const assistants = useAtomValue(assistantsAtom) @@ -25,6 +30,11 @@ export default function KeyListener({ children }: Props) { const onKeyDown = (e: KeyboardEvent) => { const prefixKey = isMac ? e.metaKey : e.ctrlKey + if (e.key === 'b' && prefixKey && e.shiftKey) { + setShowRightPanel((showRightideBar) => !showRightideBar) + return + } + if (e.key === 'n' && prefixKey) { requestCreateNewThread(assistants[0]) setMainViewState(MainViewState.Thread) @@ -43,7 +53,13 @@ export default function KeyListener({ children }: Props) { } document.addEventListener('keydown', onKeyDown) return () => document.removeEventListener('keydown', onKeyDown) - }, [assistants, requestCreateNewThread, setMainViewState, setShowLeftPanel]) + }, [ + assistants, + requestCreateNewThread, + setMainViewState, + setShowLeftPanel, + setShowRightPanel, + ]) return {children} } diff --git a/web/screens/Settings/Hotkeys/index.tsx b/web/screens/Settings/Hotkeys/index.tsx index 6434ba295..382efad2e 100644 --- a/web/screens/Settings/Hotkeys/index.tsx +++ b/web/screens/Settings/Hotkeys/index.tsx @@ -11,6 +11,11 @@ const availableHotkeys = [ modifierKeys: [isMac ? '⌘' : 'Ctrl'], description: 'Toggle collapsible left panel', }, + { + combination: 'Shift B', + modifierKeys: [isMac ? '⌘' : 'Ctrl'], + description: 'Toggle collapsible right panel', + }, { combination: ',', modifierKeys: [isMac ? '⌘' : 'Ctrl'], @@ -21,7 +26,7 @@ const availableHotkeys = [ description: 'Send a message', }, { - combination: 'Shift + Enter', + combination: 'Shift Enter', description: 'Insert new line in input box', }, {