From 251b83629aba03727ce12a598e1bbad84eafa678 Mon Sep 17 00:00:00 2001 From: aheizi Date: Fri, 28 Feb 2025 21:52:48 +0800 Subject: [PATCH] feat: add shortcut to switch modes --- .../src/components/chat/ChatTextArea.tsx | 7 ++++ webview-ui/src/components/chat/ChatView.tsx | 32 +++++++++++++++++++ .../chat/__tests__/ChatTextArea.test.tsx | 1 + 3 files changed, 40 insertions(+) diff --git a/webview-ui/src/components/chat/ChatTextArea.tsx b/webview-ui/src/components/chat/ChatTextArea.tsx index dcbe085147..a2af6a3a71 100644 --- a/webview-ui/src/components/chat/ChatTextArea.tsx +++ b/webview-ui/src/components/chat/ChatTextArea.tsx @@ -31,6 +31,7 @@ interface ChatTextAreaProps { onHeightChange?: (height: number) => void mode: Mode setMode: (value: Mode) => void + modeShortcutText: string } const ChatTextArea = forwardRef( @@ -48,6 +49,7 @@ const ChatTextArea = forwardRef( onHeightChange, mode, setMode, + modeShortcutText, }, ref, ) => { @@ -816,6 +818,11 @@ const ChatTextArea = forwardRef( minWidth: "70px", flex: "0 0 auto", }}> + {getAllModes(customModes).map((mode) => (