Elffuss BraidHub

kikocis/continue public

feat: add block icons back to lump (#7789)

* feat: add block icons back to lump

* prettier

* Update index.tsx
Changesetf67954d2bf346e2b1e840f0aa784a43fe81dd9438a50d34fa4a5f2275e3cabcf
AuthorPatrick Erichsen <patrick.a.erichsen@gmail.com> · 2025-09-17 18:24 -07:00
CommitterGitHub <noreply@github.com> · 2025-09-17 18:24 -07:00
Parents36ebc3ac99f4

Browse the files at this changeset

7 files changed

modified gui/src/components/AssistantAndOrgListbox/AssistantOption.tsx +19 −2
@@ -1,4 +1,7 @@
1-import { ExclamationTriangleIcon } from "@heroicons/react/24/outline";
1+import {
2+ Cog6ToothIcon,
3+ ExclamationTriangleIcon,
4+} from "@heroicons/react/24/outline";
25 import { ProfileDescription } from "core/config/ProfileLifecycleManager";
36 import { useContext, useMemo } from "react";
47 import { useNavigate } from "react-router-dom";
@@ -48,7 +51,7 @@
4851 disabled={hasFatalErrors}
4952 onClick={!hasFatalErrors ? handleOptionClick : undefined}
5053 fontSizeModifier={-2}
51- className={selected ? "bg-list-active text-list-active-foreground" : ""}
54+ className={`group ${selected ? "bg-list-active text-list-active-foreground" : ""}`}
5255 >
5356 <div className="flex w-full items-center justify-between gap-10 py-0.5">
5457 <div className="flex w-full items-center gap-3">
@@ -62,6 +65,20 @@
6265 </span>
6366 </div>
6467 <div className="flex flex-row items-center gap-1.5">
68+ <Button
69+ variant="ghost"
70+ size="sm"
71+ className="text-description-muted hover:enabled:text-foreground my-0 h-4 w-4 p-0 opacity-0 transition-opacity group-hover:opacity-100"
72+ onClick={(e) => {
73+ e.stopPropagation();
74+ ideMessenger.post("config/openProfile", {
75+ profileId: profile.id,
76+ });
77+ onClick(); // Close the listbox
78+ }}
79+ >
80+ <Cog6ToothIcon className="h-3.5 w-3.5" />
81+ </Button>
6582 {profile.errors && profile.errors?.length > 0 && (
6683 <ToolTip content="View errors">
6784 <Button
modified gui/src/components/AssistantAndOrgListbox/OrganizationOption.tsx +18 −4
@@ -1,14 +1,16 @@
1-import { CheckIcon } from "@heroicons/react/24/outline";
1+import { Cog6ToothIcon } from "@heroicons/react/24/outline";
22 import {
33 BuildingOfficeIcon,
44 UserCircleIcon,
55 UserIcon,
66 } from "@heroicons/react/24/solid";
77 import { useContext } from "react";
8+import { useNavigate } from "react-router-dom";
89 import { IdeMessengerContext } from "../../context/IdeMessenger";
910 import { useAppDispatch, useAppSelector } from "../../redux/hooks";
1011 import { setSelectedOrgId } from "../../redux/slices/profilesSlice";
11-import { ListboxOption } from "../ui";
12+import { CONFIG_ROUTES } from "../../util/navigation";
13+import { Button, ListboxOption } from "../ui";
1214
1315 interface OrganizationOptionProps {
1416 organization: { id: string; name: string; iconUrl?: string | null };
@@ -45,6 +47,7 @@
4547 onClose,
4648 }: OrganizationOptionProps) {
4749 const dispatch = useAppDispatch();
50+ const navigate = useNavigate();
4851 const ideMessenger = useContext(IdeMessengerContext);
4952 const selectedOrgId = useAppSelector(
5053 (state) => state.profiles.selectedOrganizationId,
@@ -64,7 +67,7 @@
6467 value={organization.id}
6568 onClick={handleOptionClick}
6669 fontSizeModifier={-2}
67- className={isSelected ? "bg-list-active text-list-active-foreground" : ""}
70+ className={`group ${isSelected ? "bg-list-active text-list-active-foreground" : ""}`}
6871 >
6972 <div className="flex w-full items-center justify-between gap-10 py-0.5">
7073 <div className="flex w-full items-center gap-3">
@@ -78,7 +81,18 @@
7881 </span>
7982 </div>
8083 <div className="flex flex-row items-center gap-1.5">
81- {isSelected && <CheckIcon className="h-3.5 w-3.5 flex-shrink-0" />}
84+ <Button
85+ variant="ghost"
86+ size="sm"
87+ className="text-description-muted hover:enabled:text-foreground my-0 h-4 w-4 p-0 opacity-0 transition-opacity group-hover:opacity-100"
88+ onClick={(e) => {
89+ e.stopPropagation();
90+ navigate(CONFIG_ROUTES.ORGANIZATIONS);
91+ onClose(); // Close the listbox
92+ }}
93+ >
94+ <Cog6ToothIcon className="h-3.5 w-3.5" />
95+ </Button>
8296 </div>
8397 </div>
8498 </ListboxOption>
modified gui/src/components/AssistantAndOrgListbox/index.tsx +2 −32
@@ -2,9 +2,7 @@
22 ArrowPathIcon,
33 ArrowRightStartOnRectangleIcon,
44 Cog6ToothIcon,
5- PencilIcon,
65 PlusIcon,
7- WrenchScrewdriverIcon,
86 } from "@heroicons/react/24/outline";
97 import { isOnPremSession } from "core/control-plane/AuthTypes";
108 import { useContext, useEffect, useRef } from "react";
@@ -155,7 +153,7 @@
155153 className="max-h-32 -translate-x-1.5 overflow-y-auto pb-0"
156154 style={{ zIndex: 200 }}
157155 >
158- <div className="flex items-center justify-between p-2">
156+ <div className="flex items-center justify-between px-1.5 py-1">
159157 <span className="text-description text-xs font-medium">
160158 Agents
161159 </span>
@@ -193,7 +191,7 @@
193191 {shouldRenderOrgInfo && (
194192 <>
195193 <Divider className="!mb-0.5 !mt-0" />
196- <div className="flex items-center justify-between p-2">
194+ <div className="flex items-center justify-between px-1.5 py-1">
197195 <span className="text-description text-xs font-medium">
198196 Organizations
199197 </span>
@@ -232,34 +230,6 @@
232230 {/* Settings Section */}
233231 {variant !== "sidebar" && (
234232 <div>
235- <Button
236- onClick={(e) => {
237- e.stopPropagation();
238- onRulesConfig();
239- }}
240- variant="ghost"
241- size="sm"
242- className="text-description hover:bg-input my-0 w-full justify-start py-1.5 pl-1 text-left"
243- >
244- <div className="flex w-full items-center">
245- <PencilIcon className="ml-1.5 mr-2 h-3.5 w-3.5 flex-shrink-0" />
246- <span className="text-2xs">Rules</span>
247- </div>
248- </Button>
249- <Button
250- onClick={(e) => {
251- e.stopPropagation();
252- onToolsConfig();
253- }}
254- variant="ghost"
255- size="sm"
256- className="text-description hover:bg-input my-0 w-full justify-start py-1.5 pl-1 text-left"
257- >
258- <div className="flex w-full items-center">
259- <WrenchScrewdriverIcon className="ml-1.5 mr-2 h-3.5 w-3.5 flex-shrink-0" />
260- <span className="text-2xs">Tools</span>
261- </div>
262- </Button>
263233 <Button
264234 onClick={(e) => {
265235 e.stopPropagation();
modified gui/src/components/mainInput/Lump/LumpToolbar/BlockSettingsTopToolbar.tsx +77 −3
@@ -1,24 +1,45 @@
1-import { ExclamationTriangleIcon } from "@heroicons/react/24/outline";
1+import {
2+ CubeIcon,
3+ ExclamationTriangleIcon,
4+ PencilIcon,
5+ WrenchScrewdriverIcon,
6+} from "@heroicons/react/24/outline";
27 import { useContext, useEffect, useState } from "react";
38 import { useNavigate } from "react-router-dom";
49 import { IdeMessengerContext } from "../../../../context/IdeMessenger";
5-import { useAppSelector } from "../../../../redux/hooks";
10+import { useAppDispatch, useAppSelector } from "../../../../redux/hooks";
11+import {
12+ selectPendingToolCalls,
13+ selectToolCallsByStatus,
14+} from "../../../../redux/selectors/selectToolCalls";
15+import { setSelectedProfile } from "../../../../redux/slices/profilesSlice";
616 import FreeTrialButton from "../../../FreeTrialButton";
717 import { ToolTip } from "../../../gui/Tooltip";
18+import HoverItem from "../../InputToolbar/HoverItem";
819
920 import { usesFreeTrialApiKey } from "core/config/usesFreeTrialApiKey";
1021 import type { FreeTrialStatus } from "core/control-plane/client";
22+import { useAuth } from "../../../../context/Auth";
1123 import { getLocalStorage } from "../../../../util/localStorage";
1224 import { CONFIG_ROUTES } from "../../../../util/navigation";
1325 import { AssistantAndOrgListbox } from "../../../AssistantAndOrgListbox";
1426
1527 export function BlockSettingsTopToolbar() {
1628 const navigate = useNavigate();
29+ const dispatch = useAppDispatch();
30+ const { selectedProfile } = useAuth();
1731
1832 const configError = useAppSelector((store) => store.config.configError);
1933 const config = useAppSelector((state) => state.config.config);
2034 const ideMessenger = useContext(IdeMessengerContext);
2135
36+ const pendingToolCalls = useAppSelector(selectPendingToolCalls);
37+ const callingToolCalls = useAppSelector((state) =>
38+ selectToolCallsByStatus(state, "calling"),
39+ );
40+ const hasActiveContent =
41+ pendingToolCalls.length > 0 || callingToolCalls.length > 0;
42+
2243 const [freeTrialStatus, setFreeTrialStatus] =
2344 useState<FreeTrialStatus | null>(null);
2445 const hasExitedFreeTrial = getLocalStorage("hasExitedFreeTrial");
@@ -53,9 +74,39 @@
5374
5475 const shouldShowError = configError && configError?.length > 0;
5576
77+ const handleRulesClick = () => {
78+ if (selectedProfile) {
79+ dispatch(setSelectedProfile(selectedProfile.id));
80+ ideMessenger.post("didChangeSelectedProfile", {
81+ id: selectedProfile.id,
82+ });
83+ }
84+ navigate(CONFIG_ROUTES.RULES);
85+ };
86+
87+ const handleToolsClick = () => {
88+ if (selectedProfile) {
89+ dispatch(setSelectedProfile(selectedProfile.id));
90+ ideMessenger.post("didChangeSelectedProfile", {
91+ id: selectedProfile.id,
92+ });
93+ }
94+ navigate(CONFIG_ROUTES.TOOLS);
95+ };
96+
97+ const handleModelsClick = () => {
98+ if (selectedProfile) {
99+ dispatch(setSelectedProfile(selectedProfile.id));
100+ ideMessenger.post("didChangeSelectedProfile", {
101+ id: selectedProfile.id,
102+ });
103+ }
104+ navigate(CONFIG_ROUTES.MODELS);
105+ };
106+
56107 return (
57108 <div className="flex flex-1 items-center justify-between gap-1.5">
58- <div>
109+ <div className="flex items-center gap-1">
59110 {shouldShowError && (
60111 <ToolTip delayShow={700} content="View configuration errors">
61112 <div
@@ -78,7 +129,30 @@
78129 </div>
79130 </ToolTip>
80131 )}
132+
133+ {!hasActiveContent && (
134+ <div className="flex items-center gap-1.5">
135+ <ToolTip content="Configure rules">
136+ <HoverItem onClick={handleRulesClick} px={2}>
137+ <PencilIcon className="text-description-muted h-3 w-3 hover:brightness-125" />
138+ </HoverItem>
139+ </ToolTip>
140+
141+ <ToolTip content="Configure tools">
142+ <HoverItem onClick={handleToolsClick} px={2}>
143+ <WrenchScrewdriverIcon className="text-description-muted h-3 w-3 hover:brightness-125" />
144+ </HoverItem>
145+ </ToolTip>
146+
147+ <ToolTip content="Configure models">
148+ <HoverItem onClick={handleModelsClick} px={2}>
149+ <CubeIcon className="text-description-muted h-3 w-3 hover:brightness-125" />
150+ </HoverItem>
151+ </ToolTip>
152+ </div>
153+ )}
81154 </div>
155+
82156 <ToolTip
83157 place="top"
84158 content={isUsingFreeTrial ? "View free trial usage" : "Select Agent"}
modified gui/src/components/modelSelection/ModelSelect.tsx +49 −32
@@ -1,6 +1,5 @@
11 import {
22 ArrowPathIcon,
3- CheckIcon,
43 ChevronDownIcon,
54 Cog6ToothIcon,
65 CubeIcon,
@@ -16,7 +15,9 @@
1615 import { updateSelectedModelByRole } from "../../redux/thunks/updateSelectedModelByRole";
1716 import { getMetaKeyLabel, isMetaEquivalentKeyPressed } from "../../util";
1817 import { CONFIG_ROUTES } from "../../util/navigation";
18+import { ToolTip } from "../gui/Tooltip";
1919 import {
20+ Button,
2021 Listbox,
2122 ListboxButton,
2223 ListboxOption,
@@ -57,6 +58,8 @@
5758 showMissingApiKeyMsg,
5859 isSelected,
5960 }: ModelOptionProps) {
61+ const navigate = useNavigate();
62+
6063 function handleOptionClick(e: any) {
6164 if (showMissingApiKeyMsg) {
6265 e.preventDefault();
@@ -64,12 +67,18 @@
6467 }
6568 }
6669
70+ function handleConfigureClick(e: React.MouseEvent) {
71+ e.stopPropagation();
72+ navigate(CONFIG_ROUTES.MODELS);
73+ }
74+
6775 return (
6876 <ListboxOption
6977 key={idx}
7078 disabled={showMissingApiKeyMsg}
7179 value={option.value}
7280 onClick={handleOptionClick}
81+ className={`group ${isSelected ? "bg-list-active text-list-active-foreground" : ""}`}
7382 >
7483 <div className="flex w-full items-center justify-between gap-5">
7584 <div className="flex items-center gap-2 py-0.5">
@@ -88,9 +97,14 @@
8897 )}
8998 </span>
9099 </div>
91- <CheckIcon
92- className={`h-3 w-3 flex-shrink-0 ${isSelected ? "" : "invisible"}`}
93- />
100+ <Button
101+ variant="ghost"
102+ size="sm"
103+ className="text-description-muted hover:enabled:text-foreground my-0 h-4 w-4 p-0 opacity-0 transition-opacity group-hover:opacity-100"
104+ onClick={handleConfigureClick}
105+ >
106+ <Cog6ToothIcon className="h-3.5 w-3.5" />
107+ </Button>
94108 </div>
95109 </ListboxOption>
96110 );
@@ -245,8 +259,21 @@
245259 />
246260 </ListboxButton>
247261 <ListboxOptions className="min-w-[160px]">
248- <div className="flex items-center justify-between gap-1 px-2 py-1">
249- <span className="text-description font-semibold">Models</span>
262+ <div className="flex items-center justify-between px-1.5 py-1">
263+ <span className="text-description text-xs font-medium">Models</span>
264+ <div className="flex items-center gap-0.5">
265+ <Button
266+ onClick={(e) => {
267+ e.stopPropagation();
268+ onClickConfigureModels(e);
269+ }}
270+ variant="ghost"
271+ size="sm"
272+ className="my-0 h-5 w-5 p-0"
273+ >
274+ <Cog6ToothIcon className="text-description h-3.5 w-3.5" />
275+ </Button>
276+ </div>
250277 </div>
251278
252279 <div className="no-scrollbar max-h-[300px] overflow-y-auto">
@@ -274,36 +301,26 @@
274301
275302 {!isConfigLoading && (
276303 <>
277- <Divider className="!mb-0" />
278-
279304 {selectedProfile?.profileType === "local" && (
280- <ListboxOption
281- key={options.length}
282- onClick={onClickAddModel}
283- value={"addModel" as any}
284- fontSizeModifier={-2}
285- className="px-2 py-2"
286- >
287- <span className="text-description text-2xs flex flex-row items-center">
288- <PlusIcon className="mr-1.5 h-3.5 w-3.5" />
289- Add Chat model
290- </span>
291- </ListboxOption>
305+ <>
306+ <Divider className="!mb-0" />
307+ <ListboxOption
308+ key={options.length}
309+ onClick={onClickAddModel}
310+ value={"addModel" as any}
311+ fontSizeModifier={-2}
312+ className="px-2 py-2"
313+ >
314+ <span className="text-description text-2xs flex flex-row items-center">
315+ <PlusIcon className="mr-1.5 h-3.5 w-3.5" />
316+ Add Chat model
317+ </span>
318+ </ListboxOption>
319+ </>
292320 )}
293321
294- <ListboxOption
295- value="configure-models"
296- fontSizeModifier={-2}
297- className="px-2 py-2"
298- onClick={onClickConfigureModels}
299- >
300- <span className="text-description text-2xs flex flex-row items-center">
301- <Cog6ToothIcon className="mr-1.5 h-3.5 w-3.5" />
302- Configure models
303- </span>
304- </ListboxOption>
305322 <Divider className="!my-0" />
306- <div className="text-description flex items-center justify-between gap-1.5 px-2 py-2">
323+ <div className="text-description flex items-center justify-start p-2">
307324 <span className="block" style={{ fontSize: tinyFont }}>
308325 <code>{getMetaKeyLabel()}'</code> to toggle model
309326 </span>
deleted gui/src/components/modelSelection/Toggle.tsx +0 −57
@@ -1,57 +0,0 @@
1-import styled from "styled-components";
2-import {
3- defaultBorderRadius,
4- lightGray,
5- vscInputBackground,
6- vscListActiveBackground,
7- vscListActiveForeground,
8-} from "..";
9-
10-const TopDiv = styled.div`
11- display: flex;
12- align-items: center;
13- text-align: center;
14- margin: auto;
15- width: fit-content;
16- cursor: pointer;
17-
18- border: 1px solid ${lightGray};
19-
20- background-color: ${vscInputBackground};
21- border-radius: ${defaultBorderRadius};
22-
23- &:hover {
24- background-color: ${lightGray}55;
25- }
26-`;
27-
28-const SubDiv = styled.div<{ selected: boolean }>`
29- text-align: center;
30- padding: 8px 12px;
31- border-radius: ${defaultBorderRadius};
32-
33- transition: all 0.2s ease-in-out;
34-
35- ${(props) =>
36- props.selected &&
37- `
38- background-color: ${vscListActiveBackground};
39- color: ${vscListActiveForeground};
40- `}
41-`;
42-
43-function Toggle(props: {
44- optionOne: string;
45- optionTwo: string;
46- selected: boolean;
47- onClick: () => void;
48-}) {
49- return (
50- <TopDiv onClick={props.onClick}>
51- <SubDiv selected={props.selected}>{props.optionOne}</SubDiv>
52- <SubDiv selected={!props.selected}>{props.optionTwo}</SubDiv>
53- </TopDiv>
54- );
55-}
56-
57-export default Toggle;
modified gui/src/pages/config/index.tsx +4 −10
@@ -1,5 +1,5 @@
11 import { isOnPremSession } from "core/control-plane/AuthTypes";
2-import React, { useEffect, useState } from "react";
2+import React, { useState } from "react";
33 import { useNavigate, useSearchParams } from "react-router-dom";
44 import { AssistantAndOrgListbox } from "../../components/AssistantAndOrgListbox";
55 import Alert from "../../components/gui/Alert";
@@ -14,17 +14,11 @@
1414 useNavigationListener();
1515 const navigate = useNavigate();
1616 const [searchParams] = useSearchParams();
17- const [activeTab, setActiveTab] = useState("settings");
17+ const [activeTab, setActiveTab] = useState(() => {
18+ return searchParams.get("tab") || "settings";
19+ });
1820 const { session, organizations } = useAuth();
1921
20- // Set initial tab from URL parameter
21- useEffect(() => {
22- const tab = searchParams.get("tab");
23- if (tab) {
24- setActiveTab(tab);
25- }
26- }, [searchParams]);
27-
2822 const allTabs = getAllTabs();
2923 const shouldRenderOrgInfo =
3024 session && organizations.length > 1 && !isOnPremSession(session);