From fbc9fad8013f34eb03fe90eeee71b7187021211a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=F0=9D=91=BE=F0=9D=92=96=F0=9D=92=99=F0=9D=92=89?= Date: Thu, 26 Dec 2024 12:52:45 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=92=84=20style:=20Support=20shortcut=20ke?= =?UTF-8?q?ys=20to=20open=20session=20settings=20=20(#5178)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../(main)/chat/(workspace)/_layout/Desktop/HotKeys.tsx | 7 +++++++ src/const/hotkeys.ts | 1 + 2 files changed, 8 insertions(+) diff --git a/src/app/(main)/chat/(workspace)/_layout/Desktop/HotKeys.tsx b/src/app/(main)/chat/(workspace)/_layout/Desktop/HotKeys.tsx index 8321622c9588e..f3b6501c869f0 100644 --- a/src/app/(main)/chat/(workspace)/_layout/Desktop/HotKeys.tsx +++ b/src/app/(main)/chat/(workspace)/_layout/Desktop/HotKeys.tsx @@ -4,6 +4,7 @@ import isEqual from 'fast-deep-equal'; import { useHotkeys } from 'react-hotkeys-hook'; import { HOTKEYS } from '@/const/hotkeys'; +import { useOpenChatSettings } from '@/hooks/useInterceptingRoutes'; import { useChatStore } from '@/store/chat'; import { chatSelectors } from '@/store/chat/selectors'; import { useGlobalStore } from '@/store/global'; @@ -13,12 +14,18 @@ const HotKeys = () => { const lastMessage = useChatStore(chatSelectors.latestMessage, isEqual); const toggleZenMode = useGlobalStore((s) => s.toggleZenMode); + const openChatSettings = useOpenChatSettings(); useHotkeys(HOTKEYS.zenMode, toggleZenMode, { enableOnFormTags: true, preventDefault: true, }); + useHotkeys(HOTKEYS.chatSettings, () => openChatSettings(), { + enableOnFormTags: true, + preventDefault: true, + }); + useHotkeys( HOTKEYS.regenerate, () => { diff --git a/src/const/hotkeys.ts b/src/const/hotkeys.ts index 03f2d63980dd8..b85e9f4f09fb0 100644 --- a/src/const/hotkeys.ts +++ b/src/const/hotkeys.ts @@ -4,6 +4,7 @@ export const SAVE_TOPIC_KEY = 'n'; export const CLEAN_MESSAGE_KEY = 'backspace'; export const HOTKEYS = { + chatSettings: 'mod+comma', regenerate: 'alt+r', saveTopic: 'alt+n', zenMode: 'mod+\\',