diff --git a/gui/src/components/mainInput/ComboBox.tsx b/gui/src/components/mainInput/ComboBox.tsx index 7c5bf02db..98dfd9b7f 100644 --- a/gui/src/components/mainInput/ComboBox.tsx +++ b/gui/src/components/mainInput/ComboBox.tsx @@ -38,7 +38,6 @@ import { PlusIcon, SparklesIcon, TrashIcon, - XMarkIcon, ExclamationCircleIcon, } from "@heroicons/react/24/outline"; import { postToIde } from "../../util/ide"; @@ -47,7 +46,6 @@ import { MeiliSearch } from "meilisearch"; import { setBottomMessage } from "../../redux/slices/uiStateSlice"; import { useDispatch, useSelector } from "react-redux"; import { RootStore } from "../../redux/store"; -import ContinueButton from "./ContinueButton"; import { getFontSize, getMarkdownLanguageTagForFile, @@ -204,6 +202,59 @@ const MainTextInput = styled.textarea<{ &::placeholder { color: ${lightGray}cc; } + + position: relative; +`; + +const InputToolbar = styled.div` + position: absolute; + display: flex; + gap: 4px; + right: 12px; + bottom: 4px; + width: calc(100% - 28px); + + align-items: center; + z-index: 100; + font-size: 10px; + + cursor: text; +`; + +const EnterButton = styled.div<{ offFocus: boolean }>` + padding: 2px 4px; + display: flex; + align-items: center; + + background-color: ${(props) => + props.offFocus ? undefined : lightGray + "33"}; + border-radius: ${defaultBorderRadius}; + color: #fff8; + + &:hover { + background-color: #cf313199; + color: white; + } + + 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}; + + &:hover { + } + + cursor: pointer; `; const DeleteButtonDiv = styled.div` @@ -855,6 +906,16 @@ const ComboBox = React.forwardRef((props: ComboBoxProps, ref) => { backgroundColor: vscBackground, }} > + {active && props.isMainInput && ( + { + client?.stopSession(); + dispatch(setActive(false)); + }} + > + ⌘ ⌫ Cancel + + )} {selectedContextItems.length === 0 && props.isMainInput && (
{ width: "calc(100% - 24px)", }} > - { - downshiftProps.setInputValue("@"); - inputRef.current?.focus(); - }} - className="hover:underline cursor-pointer" - > - + Add Context - {downshiftProps.inputValue?.startsWith("/edit") && ( Inserting at cursor )} @@ -1360,6 +1412,72 @@ const ComboBox = React.forwardRef((props: ComboBoxProps, ref) => { ref: inputRef, })} /> + + {(inputFocused || props.isMainInput) && ( + + { + downshiftProps.setInputValue("@"); + inputRef.current?.focus(); + }} + className="hover:underline cursor-pointer mr-auto" + > + + Add Context + + { + const inputValue = downshiftProps.inputValue; + if (inputValue?.startsWith("/codebase")) { + downshiftProps.setInputValue( + inputValue.replace("/codebase ", "") + ); + } else { + downshiftProps.setInputValue("/codebase " + inputValue); + } + inputRef.current?.focus(); + }} + className={"hover:underline cursor-pointer float-right"} + > + {downshiftProps.inputValue?.startsWith("/codebase") + ? "Using codebase" + : `${getMetaKeyLabel()} ⏎ Use codebase`} + + + { + if (active) { + client?.stopSession(); + dispatch(setActive(false)); + } else { + props.onEnter?.(undefined); + } + }} + > + ⏎ Enter + + + )} {props.isMainInput || ( {isHovered && ( @@ -1394,7 +1512,7 @@ const ComboBox = React.forwardRef((props: ComboBoxProps, ref) => { )} - { e.stopPropagation(); if (props.active && props.groupIndices) { @@ -1411,7 +1529,7 @@ const ComboBox = React.forwardRef((props: ComboBoxProps, ref) => { // )} - + */}
)} @@ -1554,59 +1672,12 @@ const ComboBox = React.forwardRef((props: ComboBoxProps, ref) => { - {props.isMainInput && ( <> -
- { - const inputValue = downshiftProps.inputValue; - if (inputValue?.startsWith("/codebase")) { - downshiftProps.setInputValue( - inputValue.replace("/codebase ", "") - ); - } else { - downshiftProps.setInputValue("/codebase " + inputValue); - } - inputRef.current?.focus(); - }} - className={"hover:underline cursor-pointer float-right"} - > - {downshiftProps.inputValue?.startsWith("/codebase") - ? "Using codebase" - : `${getMetaKeyLabel()} ⏎ Use codebase`} - -
+

)} - - {props.isMainInput && ( - { - if (active) { - client?.stopSession(); - dispatch(setActive(false)); - } else { - props.onEnter?.(undefined); - } - }} - showStop={active} - /> - )} ); });