Changesets · Branches · Tags · Compare
| Changeset | f67954d2bf346e2b1e840f0aa784a43fe81dd9438a50d34fa4a5f2275e3cabcf |
|---|---|
| Author | Patrick Erichsen <patrick.a.erichsen@gmail.com> · 2025-09-17 18:24 -07:00 |
| Committer | GitHub <noreply@github.com> · 2025-09-17 18:24 -07:00 |
| Parents | 36ebc3ac99f4 |
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"; | |
| 2 | 5 | import { ProfileDescription } from "core/config/ProfileLifecycleManager"; |
| 3 | 6 | import { useContext, useMemo } from "react"; |
| 4 | 7 | import { useNavigate } from "react-router-dom"; |
| @@ -48,7 +51,7 @@ | ||
| 48 | 51 | disabled={hasFatalErrors} |
| 49 | 52 | onClick={!hasFatalErrors ? handleOptionClick : undefined} |
| 50 | 53 | fontSizeModifier={-2} |
| 51 | - className={selected ? "bg-list-active text-list-active-foreground" : ""} | |
| 54 | + className={`group ${selected ? "bg-list-active text-list-active-foreground" : ""}`} | |
| 52 | 55 | > |
| 53 | 56 | <div className="flex w-full items-center justify-between gap-10 py-0.5"> |
| 54 | 57 | <div className="flex w-full items-center gap-3"> |
| @@ -62,6 +65,20 @@ | ||
| 62 | 65 | </span> |
| 63 | 66 | </div> |
| 64 | 67 | <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> | |
| 65 | 82 | {profile.errors && profile.errors?.length > 0 && ( |
| 66 | 83 | <ToolTip content="View errors"> |
| 67 | 84 | <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"; | |
| 2 | 2 | import { |
| 3 | 3 | BuildingOfficeIcon, |
| 4 | 4 | UserCircleIcon, |
| 5 | 5 | UserIcon, |
| 6 | 6 | } from "@heroicons/react/24/solid"; |
| 7 | 7 | import { useContext } from "react"; |
| 8 | +import { useNavigate } from "react-router-dom"; | |
| 8 | 9 | import { IdeMessengerContext } from "../../context/IdeMessenger"; |
| 9 | 10 | import { useAppDispatch, useAppSelector } from "../../redux/hooks"; |
| 10 | 11 | import { setSelectedOrgId } from "../../redux/slices/profilesSlice"; |
| 11 | -import { ListboxOption } from "../ui"; | |
| 12 | +import { CONFIG_ROUTES } from "../../util/navigation"; | |
| 13 | +import { Button, ListboxOption } from "../ui"; | |
| 12 | 14 | |
| 13 | 15 | interface OrganizationOptionProps { |
| 14 | 16 | organization: { id: string; name: string; iconUrl?: string | null }; |
| @@ -45,6 +47,7 @@ | ||
| 45 | 47 | onClose, |
| 46 | 48 | }: OrganizationOptionProps) { |
| 47 | 49 | const dispatch = useAppDispatch(); |
| 50 | + const navigate = useNavigate(); | |
| 48 | 51 | const ideMessenger = useContext(IdeMessengerContext); |
| 49 | 52 | const selectedOrgId = useAppSelector( |
| 50 | 53 | (state) => state.profiles.selectedOrganizationId, |
| @@ -64,7 +67,7 @@ | ||
| 64 | 67 | value={organization.id} |
| 65 | 68 | onClick={handleOptionClick} |
| 66 | 69 | fontSizeModifier={-2} |
| 67 | - className={isSelected ? "bg-list-active text-list-active-foreground" : ""} | |
| 70 | + className={`group ${isSelected ? "bg-list-active text-list-active-foreground" : ""}`} | |
| 68 | 71 | > |
| 69 | 72 | <div className="flex w-full items-center justify-between gap-10 py-0.5"> |
| 70 | 73 | <div className="flex w-full items-center gap-3"> |
| @@ -78,7 +81,18 @@ | ||
| 78 | 81 | </span> |
| 79 | 82 | </div> |
| 80 | 83 | <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> | |
| 82 | 96 | </div> |
| 83 | 97 | </div> |
| 84 | 98 | </ListboxOption> |
modified gui/src/components/AssistantAndOrgListbox/index.tsx +2 −32
| @@ -2,9 +2,7 @@ | ||
| 2 | 2 | ArrowPathIcon, |
| 3 | 3 | ArrowRightStartOnRectangleIcon, |
| 4 | 4 | Cog6ToothIcon, |
| 5 | - PencilIcon, | |
| 6 | 5 | PlusIcon, |
| 7 | - WrenchScrewdriverIcon, | |
| 8 | 6 | } from "@heroicons/react/24/outline"; |
| 9 | 7 | import { isOnPremSession } from "core/control-plane/AuthTypes"; |
| 10 | 8 | import { useContext, useEffect, useRef } from "react"; |
| @@ -155,7 +153,7 @@ | ||
| 155 | 153 | className="max-h-32 -translate-x-1.5 overflow-y-auto pb-0" |
| 156 | 154 | style={{ zIndex: 200 }} |
| 157 | 155 | > |
| 158 | - <div className="flex items-center justify-between p-2"> | |
| 156 | + <div className="flex items-center justify-between px-1.5 py-1"> | |
| 159 | 157 | <span className="text-description text-xs font-medium"> |
| 160 | 158 | Agents |
| 161 | 159 | </span> |
| @@ -193,7 +191,7 @@ | ||
| 193 | 191 | {shouldRenderOrgInfo && ( |
| 194 | 192 | <> |
| 195 | 193 | <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"> | |
| 197 | 195 | <span className="text-description text-xs font-medium"> |
| 198 | 196 | Organizations |
| 199 | 197 | </span> |
| @@ -232,34 +230,6 @@ | ||
| 232 | 230 | {/* Settings Section */} |
| 233 | 231 | {variant !== "sidebar" && ( |
| 234 | 232 | <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> | |
| 263 | 233 | <Button |
| 264 | 234 | onClick={(e) => { |
| 265 | 235 | 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"; | |
| 2 | 7 | import { useContext, useEffect, useState } from "react"; |
| 3 | 8 | import { useNavigate } from "react-router-dom"; |
| 4 | 9 | 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"; | |
| 6 | 16 | import FreeTrialButton from "../../../FreeTrialButton"; |
| 7 | 17 | import { ToolTip } from "../../../gui/Tooltip"; |
| 18 | +import HoverItem from "../../InputToolbar/HoverItem"; | |
| 8 | 19 | |
| 9 | 20 | import { usesFreeTrialApiKey } from "core/config/usesFreeTrialApiKey"; |
| 10 | 21 | import type { FreeTrialStatus } from "core/control-plane/client"; |
| 22 | +import { useAuth } from "../../../../context/Auth"; | |
| 11 | 23 | import { getLocalStorage } from "../../../../util/localStorage"; |
| 12 | 24 | import { CONFIG_ROUTES } from "../../../../util/navigation"; |
| 13 | 25 | import { AssistantAndOrgListbox } from "../../../AssistantAndOrgListbox"; |
| 14 | 26 | |
| 15 | 27 | export function BlockSettingsTopToolbar() { |
| 16 | 28 | const navigate = useNavigate(); |
| 29 | + const dispatch = useAppDispatch(); | |
| 30 | + const { selectedProfile } = useAuth(); | |
| 17 | 31 | |
| 18 | 32 | const configError = useAppSelector((store) => store.config.configError); |
| 19 | 33 | const config = useAppSelector((state) => state.config.config); |
| 20 | 34 | const ideMessenger = useContext(IdeMessengerContext); |
| 21 | 35 | |
| 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 | + | |
| 22 | 43 | const [freeTrialStatus, setFreeTrialStatus] = |
| 23 | 44 | useState<FreeTrialStatus | null>(null); |
| 24 | 45 | const hasExitedFreeTrial = getLocalStorage("hasExitedFreeTrial"); |
| @@ -53,9 +74,39 @@ | ||
| 53 | 74 | |
| 54 | 75 | const shouldShowError = configError && configError?.length > 0; |
| 55 | 76 | |
| 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 | + | |
| 56 | 107 | return ( |
| 57 | 108 | <div className="flex flex-1 items-center justify-between gap-1.5"> |
| 58 | - <div> | |
| 109 | + <div className="flex items-center gap-1"> | |
| 59 | 110 | {shouldShowError && ( |
| 60 | 111 | <ToolTip delayShow={700} content="View configuration errors"> |
| 61 | 112 | <div |
| @@ -78,7 +129,30 @@ | ||
| 78 | 129 | </div> |
| 79 | 130 | </ToolTip> |
| 80 | 131 | )} |
| 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 | + )} | |
| 81 | 154 | </div> |
| 155 | + | |
| 82 | 156 | <ToolTip |
| 83 | 157 | place="top" |
| 84 | 158 | content={isUsingFreeTrial ? "View free trial usage" : "Select Agent"} |
modified gui/src/components/modelSelection/ModelSelect.tsx +49 −32
| @@ -1,6 +1,5 @@ | ||
| 1 | 1 | import { |
| 2 | 2 | ArrowPathIcon, |
| 3 | - CheckIcon, | |
| 4 | 3 | ChevronDownIcon, |
| 5 | 4 | Cog6ToothIcon, |
| 6 | 5 | CubeIcon, |
| @@ -16,7 +15,9 @@ | ||
| 16 | 15 | import { updateSelectedModelByRole } from "../../redux/thunks/updateSelectedModelByRole"; |
| 17 | 16 | import { getMetaKeyLabel, isMetaEquivalentKeyPressed } from "../../util"; |
| 18 | 17 | import { CONFIG_ROUTES } from "../../util/navigation"; |
| 18 | +import { ToolTip } from "../gui/Tooltip"; | |
| 19 | 19 | import { |
| 20 | + Button, | |
| 20 | 21 | Listbox, |
| 21 | 22 | ListboxButton, |
| 22 | 23 | ListboxOption, |
| @@ -57,6 +58,8 @@ | ||
| 57 | 58 | showMissingApiKeyMsg, |
| 58 | 59 | isSelected, |
| 59 | 60 | }: ModelOptionProps) { |
| 61 | + const navigate = useNavigate(); | |
| 62 | + | |
| 60 | 63 | function handleOptionClick(e: any) { |
| 61 | 64 | if (showMissingApiKeyMsg) { |
| 62 | 65 | e.preventDefault(); |
| @@ -64,12 +67,18 @@ | ||
| 64 | 67 | } |
| 65 | 68 | } |
| 66 | 69 | |
| 70 | + function handleConfigureClick(e: React.MouseEvent) { | |
| 71 | + e.stopPropagation(); | |
| 72 | + navigate(CONFIG_ROUTES.MODELS); | |
| 73 | + } | |
| 74 | + | |
| 67 | 75 | return ( |
| 68 | 76 | <ListboxOption |
| 69 | 77 | key={idx} |
| 70 | 78 | disabled={showMissingApiKeyMsg} |
| 71 | 79 | value={option.value} |
| 72 | 80 | onClick={handleOptionClick} |
| 81 | + className={`group ${isSelected ? "bg-list-active text-list-active-foreground" : ""}`} | |
| 73 | 82 | > |
| 74 | 83 | <div className="flex w-full items-center justify-between gap-5"> |
| 75 | 84 | <div className="flex items-center gap-2 py-0.5"> |
| @@ -88,9 +97,14 @@ | ||
| 88 | 97 | )} |
| 89 | 98 | </span> |
| 90 | 99 | </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> | |
| 94 | 108 | </div> |
| 95 | 109 | </ListboxOption> |
| 96 | 110 | ); |
| @@ -245,8 +259,21 @@ | ||
| 245 | 259 | /> |
| 246 | 260 | </ListboxButton> |
| 247 | 261 | <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> | |
| 250 | 277 | </div> |
| 251 | 278 | |
| 252 | 279 | <div className="no-scrollbar max-h-[300px] overflow-y-auto"> |
| @@ -274,36 +301,26 @@ | ||
| 274 | 301 | |
| 275 | 302 | {!isConfigLoading && ( |
| 276 | 303 | <> |
| 277 | - <Divider className="!mb-0" /> | |
| 278 | - | |
| 279 | 304 | {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 | + </> | |
| 292 | 320 | )} |
| 293 | 321 | |
| 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> | |
| 305 | 322 | <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"> | |
| 307 | 324 | <span className="block" style={{ fontSize: tinyFont }}> |
| 308 | 325 | <code>{getMetaKeyLabel()}'</code> to toggle model |
| 309 | 326 | </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 @@ | ||
| 1 | 1 | import { isOnPremSession } from "core/control-plane/AuthTypes"; |
| 2 | -import React, { useEffect, useState } from "react"; | |
| 2 | +import React, { useState } from "react"; | |
| 3 | 3 | import { useNavigate, useSearchParams } from "react-router-dom"; |
| 4 | 4 | import { AssistantAndOrgListbox } from "../../components/AssistantAndOrgListbox"; |
| 5 | 5 | import Alert from "../../components/gui/Alert"; |
| @@ -14,17 +14,11 @@ | ||
| 14 | 14 | useNavigationListener(); |
| 15 | 15 | const navigate = useNavigate(); |
| 16 | 16 | const [searchParams] = useSearchParams(); |
| 17 | - const [activeTab, setActiveTab] = useState("settings"); | |
| 17 | + const [activeTab, setActiveTab] = useState(() => { | |
| 18 | + return searchParams.get("tab") || "settings"; | |
| 19 | + }); | |
| 18 | 20 | const { session, organizations } = useAuth(); |
| 19 | 21 | |
| 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 | - | |
| 28 | 22 | const allTabs = getAllTabs(); |
| 29 | 23 | const shouldRenderOrgInfo = |
| 30 | 24 | session && organizations.length > 1 && !isOnPremSession(session); |