From 5aac2b54507e7dacc3dd616ef4b72f9949c3a03e Mon Sep 17 00:00:00 2001 From: Nate Date: Sat, 1 Feb 2025 01:44:03 -0800 Subject: [PATCH] fix display of orgs dropdown --- gui/src/context/Auth.tsx | 7 ----- gui/src/pages/config/index.tsx | 52 ++++++++++++++++++++-------------- 2 files changed, 31 insertions(+), 28 deletions(-) diff --git a/gui/src/context/Auth.tsx b/gui/src/context/Auth.tsx index 23eb08821..5154c67ae 100644 --- a/gui/src/context/Auth.tsx +++ b/gui/src/context/Auth.tsx @@ -49,13 +49,6 @@ export const AuthProvider: React.FC<{ children: React.ReactNode }> = ({ ); const ideMessenger = useContext(IdeMessengerContext); - const [hubEnabled, setHubEnabled] = useState(false); - - useEffect(() => { - ideMessenger.ide.getIdeSettings().then(({ continueTestEnvironment }) => { - setHubEnabled(continueTestEnvironment === "production"); - }); - }, [ideMessenger]); const selectedOrganizationId = useAppSelector( (store) => store.session.selectedOrganizationId, diff --git a/gui/src/pages/config/index.tsx b/gui/src/pages/config/index.tsx index 761bd6e3a..5f9cf3d09 100644 --- a/gui/src/pages/config/index.tsx +++ b/gui/src/pages/config/index.tsx @@ -1,23 +1,23 @@ import { useContext, useEffect, useState } from "react"; import { useNavigate } from "react-router-dom"; +import PageHeader from "../../components/PageHeader"; import { IdeMessengerContext } from "../../context/IdeMessenger"; import { useNavigationListener } from "../../hooks/useNavigationListener"; -import PageHeader from "../../components/PageHeader"; import { useAppDispatch, useAppSelector } from "../../redux/hooks"; -import { updateConfig } from "../../redux/slices/configSlice"; -import ToggleSwitch from "../../components/gui/Switch"; -import { useAuth } from "../../context/Auth"; -import { Input, SecondaryButton } from "../../components"; -import { getFontSize } from "../../util"; import { CheckIcon, XMarkIcon } from "@heroicons/react/24/outline"; -import { ScopeSelect } from "./ScopeSelect"; import { SharedConfigSchema, modifyContinueConfigWithSharedConfig, } from "core/config/sharedConfig"; +import { Input, SecondaryButton } from "../../components"; import NumberInput from "../../components/gui/NumberInput"; import { Select } from "../../components/gui/Select"; +import ToggleSwitch from "../../components/gui/Switch"; +import { useAuth } from "../../context/Auth"; +import { updateConfig } from "../../redux/slices/configSlice"; +import { getFontSize } from "../../util"; +import { ScopeSelect } from "./ScopeSelect"; function ConfigPage() { useNavigationListener(); @@ -25,7 +25,7 @@ function ConfigPage() { const navigate = useNavigate(); const ideMessenger = useContext(IdeMessengerContext); - const { selectedProfile, selectedOrganization } = useAuth(); + const { selectedProfile, selectedOrganization, session } = useAuth(); const config = useAppSelector((state) => state.config.config); function handleUpdate(sharedConfig: Partial) { @@ -52,6 +52,14 @@ function ConfigPage() { config.tabAutocompleteOptions?.multilineCompletions ?? "auto"; const fontSize = getFontSize(); + const [hubEnabled, setHubEnabled] = useState(false); + + useEffect(() => { + ideMessenger.ide.getIdeSettings().then(({ continueTestEnvironment }) => { + setHubEnabled(continueTestEnvironment === "production"); + }); + }, [ideMessenger]); + // Disable autocomplete const disableAutocompleteInFiles = ( config.tabAutocompleteOptions?.disableInFiles ?? [] @@ -121,21 +129,23 @@ function ConfigPage() { navigate("/")} title="Chat" />
-
-
-

Account

- {selectedOrganization?.name && ( - - You are currently signed in to{" "} - - {selectedOrganization?.name} + {hubEnabled && !!session && ( +
+
+

Account

+ {selectedOrganization?.name && ( + + You are currently signed in to{" "} + + {selectedOrganization?.name} + - - )} -
+ )} +
- -
+ +
+ )}

Configuration