From 050424424ecaf5310ebf14e01c1b6607129343df Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Mon, 24 Mar 2025 18:51:12 -0700 Subject: [PATCH] UI tweaks --- .../CodeToEditCard/AddFileButton.tsx | 11 +--- .../CodeToEditCard/AddFileCombobox.tsx | 2 +- .../mainInput/tiptap/TipTapEditor.tsx | 20 ++++-- .../components/modelSelection/ModeSelect.tsx | 29 +++++++- gui/src/components/ui/Listbox.tsx | 2 +- gui/src/pages/config/AccountButton.tsx | 4 +- gui/src/pages/config/ScopeSelect.tsx | 66 ++++++++----------- 7 files changed, 74 insertions(+), 60 deletions(-) diff --git a/gui/src/components/CodeToEditCard/AddFileButton.tsx b/gui/src/components/CodeToEditCard/AddFileButton.tsx index a5b9364b7..18316a5d7 100644 --- a/gui/src/components/CodeToEditCard/AddFileButton.tsx +++ b/gui/src/components/CodeToEditCard/AddFileButton.tsx @@ -36,7 +36,7 @@ export default function AddFileButton({ onClick }: AddFileButtonProps) {
- - - Add all open files - + + Add all open files
diff --git a/gui/src/components/CodeToEditCard/AddFileCombobox.tsx b/gui/src/components/CodeToEditCard/AddFileCombobox.tsx index 5d8f92559..d096f90a2 100644 --- a/gui/src/components/CodeToEditCard/AddFileCombobox.tsx +++ b/gui/src/components/CodeToEditCard/AddFileCombobox.tsx @@ -70,7 +70,7 @@ export default function AddFileCombobox({ onFocus={() => { buttonRef.current?.click(); }} - className="bg-vsc-background border-lightgray text-vsc-foreground box-border w-full rounded border border-solid py-0.5 pl-2 focus:outline-none" + className="bg-vsc-background border-lightgray text-vsc-foreground box-border w-full rounded border border-solid py-0.5 pl-2 text-xs focus:outline-none" onChange={(event) => setQuery(event.target.value)} placeholder="Type to search files..." onKeyDown={(e) => { diff --git a/gui/src/components/mainInput/tiptap/TipTapEditor.tsx b/gui/src/components/mainInput/tiptap/TipTapEditor.tsx index 722cb007c..cef58128e 100644 --- a/gui/src/components/mainInput/tiptap/TipTapEditor.tsx +++ b/gui/src/components/mainInput/tiptap/TipTapEditor.tsx @@ -75,6 +75,9 @@ function TipTapEditor(props: TipTapEditorProps) { }, [editor, props.placeholder, historyLength]); useEffect(() => { + if (isInEditMode) { + setShouldHideToolbar(false); + } if (props.isMainInput) { editor?.commands.clearContent(true); } @@ -155,14 +158,19 @@ function TipTapEditor(props: TipTapEditorProps) { const handleBlur = (e: React.FocusEvent) => { // Check if the new focus target is within our InputBoxDiv - const currentTarget = e.currentTarget; - const relatedTarget = e.relatedTarget as Node | null; + queueMicrotask(() => { + if (isInEditMode) { + return; + } + const currentTarget = e.currentTarget; + const relatedTarget = e.relatedTarget as Node | null; - if (relatedTarget && currentTarget.contains(relatedTarget)) { - return; - } + if (relatedTarget && currentTarget.contains(relatedTarget)) { + return; + } - setShouldHideToolbar(true); + setShouldHideToolbar(true); + }); }; return ( diff --git a/gui/src/components/modelSelection/ModeSelect.tsx b/gui/src/components/modelSelection/ModeSelect.tsx index 69a77b605..13ac33da4 100644 --- a/gui/src/components/modelSelection/ModeSelect.tsx +++ b/gui/src/components/modelSelection/ModeSelect.tsx @@ -18,6 +18,11 @@ import { selectCurrentMode, setMode, } from "../../redux/slices/sessionSlice"; +import { exitEditMode } from "../../redux/thunks"; +import { + loadLastSession, + saveCurrentSession, +} from "../../redux/thunks/session"; import { getFontSize, getMetaKeyLabel, isJetBrains } from "../../util"; import { Listbox, @@ -78,8 +83,26 @@ function ModeSelect() { return ( { + onChange={async (newMode) => { + if (newMode === mode) { + return; + } dispatch(setMode(newMode)); + if (newMode === "edit") { + await dispatch( + saveCurrentSession({ + generateTitle: false, + openNewSession: true, + }), + ); + } else if (mode === "edit") { + await dispatch( + loadLastSession({ + saveCurrentSession: false, + }), + ); + dispatch(exitEditMode()); + } }} >
@@ -91,7 +114,9 @@ function ModeSelect() { }} > {getModeIcon(mode)} - {mode.charAt(0).toUpperCase() + mode.slice(1)} + + {mode.charAt(0).toUpperCase() + mode.slice(1)} +