From 892ee87b71f876fccc79066107b4936e6bf0eb99 Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Tue, 5 Dec 2023 19:35:08 -0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=92=84=20remove=20input=20box=20while=20g?= =?UTF-8?q?enerating?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gui/src/components/mainInput/ComboBox.tsx | 25 ------ gui/src/pages/gui.tsx | 103 ++++++++-------------- 2 files changed, 37 insertions(+), 91 deletions(-) diff --git a/gui/src/components/mainInput/ComboBox.tsx b/gui/src/components/mainInput/ComboBox.tsx index 65672ca86..f6b2e8646 100644 --- a/gui/src/components/mainInput/ComboBox.tsx +++ b/gui/src/components/mainInput/ComboBox.tsx @@ -243,21 +243,6 @@ const EnterButton = styled.div<{ offFocus: boolean }>` cursor: pointer; `; -const StopButton = styled.div` - width: fit-content; - margin-right: auto; - margin-left: auto; - - font-size: 12px; - - border: 0.5px solid ${lightGray}; - border-radius: ${defaultBorderRadius}; - padding: 4px 8px; - color: ${lightGray}; - - cursor: pointer; -`; - const NewSessionButton = styled.div` width: fit-content; margin-right: auto; @@ -938,16 +923,6 @@ const ComboBox = React.forwardRef((props: ComboBoxProps, ref) => { backgroundColor: vscBackground, }} > - {active && props.isMainInput && ( - { - client?.stopSession(); - dispatch(setActive(false)); - }} - > - ⌘ ⌫ Cancel - - )} {selectedContextItems.length === 0 && props.isMainInput && (
{ - const handleKeyDown = (event: any) => { - if (event.metaKey && event.altKey && event.code === "KeyN") { - client?.stopSession(); - persistSession(); - dispatch(newSession()); - mainTextInputRef.current?.focus?.(); - } - }; - - window.addEventListener("keydown", handleKeyDown); - - return () => { - window.removeEventListener("keydown", handleKeyDown); - }; - }, [client, persistSession, mainTextInputRef]); - useEffect(() => { const handler = (event: any) => { if (event.data.type === "newSession") { @@ -824,19 +784,30 @@ function GUI(props: GUIProps) {
- { - onMainTextInput(e); - e?.stopPropagation(); - e?.preventDefault(); - }} - onInputValueChange={() => {}} - onToggleAddContext={() => { - client?.toggleAddingHighlightedCode(); - }} - /> + {active ? ( + { + client?.stopSession(); + dispatch(setActive(false)); + }} + > + ⌘ ⌫ Cancel + + ) : ( + { + onMainTextInput(e); + e?.stopPropagation(); + e?.preventDefault(); + }} + onInputValueChange={() => {}} + onToggleAddContext={() => { + client?.toggleAddingHighlightedCode(); + }} + /> + )}
);