From 32ecdce887c421d660b5ce3ac29a0c0cda107ec0 Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Fri, 14 Feb 2025 08:38:29 -0800 Subject: [PATCH] styling --- .../modelSelection/ModelSelectionListbox.tsx | 9 ++----- .../platform/AssistantSelect.tsx | 7 ++---- gui/src/context/Auth.tsx | 6 ++--- gui/src/pages/config/ScopeSelect.tsx | 10 ++++---- gui/src/pages/config/index.tsx | 25 ++++++++++++------- gui/src/redux/thunks/profileAndOrg.ts | 3 ++- 6 files changed, 30 insertions(+), 30 deletions(-) diff --git a/gui/src/components/modelSelection/ModelSelectionListbox.tsx b/gui/src/components/modelSelection/ModelSelectionListbox.tsx index aadf4319c..d48ffceed 100644 --- a/gui/src/components/modelSelection/ModelSelectionListbox.tsx +++ b/gui/src/components/modelSelection/ModelSelectionListbox.tsx @@ -4,24 +4,19 @@ import { ChevronUpDownIcon, CubeIcon, } from "@heroicons/react/24/outline"; -import { Dispatch, Fragment, SetStateAction } from "react"; +import { Fragment } from "react"; import { Listbox } from "@headlessui/react"; import styled from "styled-components"; import { defaultBorderRadius, lightGray, vscBackground, - vscButtonBackground, vscForeground, vscInputBackground, vscListActiveBackground, vscListActiveForeground, } from ".."; -import { - DisplayInfo, - ModelPackage, -} from "../../pages/AddNewModel/configs/models"; -import { ProviderInfo } from "../../pages/AddNewModel/configs/providers"; +import { DisplayInfo } from "../../pages/AddNewModel/configs/models"; export const StyledListbox = styled(Listbox)` background-color: ${vscBackground}; diff --git a/gui/src/components/modelSelection/platform/AssistantSelect.tsx b/gui/src/components/modelSelection/platform/AssistantSelect.tsx index 186ebde44..55e60449d 100644 --- a/gui/src/components/modelSelection/platform/AssistantSelect.tsx +++ b/gui/src/components/modelSelection/platform/AssistantSelect.tsx @@ -3,7 +3,6 @@ import { ChevronDownIcon } from "@heroicons/react/24/outline"; import { useEffect, useRef } from "react"; import { useAuth } from "../../../context/Auth"; import { useAppDispatch } from "../../../redux/hooks"; -import { cycleProfile } from "../../../redux/thunks/cycleProfile"; import { getFontSize, isLocalProfile, @@ -13,15 +12,13 @@ import PopoverTransition from "../../mainInput/InputToolbar/PopoverTransition"; import { AssistantSelectOptions } from "./AssistantSelectOptions"; import AssistantIcon from "./AssistantIcon"; import { getProfileDisplayText } from "./utils"; +import { cycleProfile } from "../../../redux/thunks/profileAndOrg"; export default function AssistantSelect() { const dispatch = useAppDispatch(); const buttonRef = useRef(null); const { selectedProfile } = useAuth(); - const isLocalProfileSelected = - selectedProfile && isLocalProfile(selectedProfile); - useEffect(() => { let lastToggleTime = 0; const DEBOUNCE_MS = 500; @@ -57,7 +54,7 @@ export default function AssistantSelect() {
diff --git a/gui/src/context/Auth.tsx b/gui/src/context/Auth.tsx index 8d49e6348..82aafc928 100644 --- a/gui/src/context/Auth.tsx +++ b/gui/src/context/Auth.tsx @@ -144,13 +144,13 @@ export const AuthProvider: React.FC<{ children: React.ReactNode }> = ({ .request("controlPlane/listOrganizations", undefined) .then((result) => { if (result.status === "success") { - updateOrgsThunk(result.content); + dispatch(updateOrgsThunk(result.content)); } else { - updateOrgsThunk([]); + dispatch(updateOrgsThunk([])); } }); } else { - updateOrgsThunk([]); + dispatch(updateOrgsThunk([])); } }, [session]); diff --git a/gui/src/pages/config/ScopeSelect.tsx b/gui/src/pages/config/ScopeSelect.tsx index eca1c4cc2..c67f68241 100644 --- a/gui/src/pages/config/ScopeSelect.tsx +++ b/gui/src/pages/config/ScopeSelect.tsx @@ -1,7 +1,7 @@ import { Listbox } from "@headlessui/react"; import { BuildingOfficeIcon, - ChevronDownIcon, + ChevronUpDownIcon, UserCircleIcon, } from "@heroicons/react/24/outline"; import { useAuth } from "../../context/Auth"; @@ -31,7 +31,7 @@ export function ScopeSelect() { return (
- +
{selectedDisplay?.iconUrl ? ( @@ -43,7 +43,7 @@ export function ScopeSelect() { {selectedDisplay?.name || "Select Organization"}
-
@@ -57,7 +57,7 @@ export function ScopeSelect() {
{org.iconUrl ? ( @@ -76,7 +76,7 @@ export function ScopeSelect() {
diff --git a/gui/src/pages/config/index.tsx b/gui/src/pages/config/index.tsx index e4428fa33..6a00aa8cc 100644 --- a/gui/src/pages/config/index.tsx +++ b/gui/src/pages/config/index.tsx @@ -9,7 +9,7 @@ import { useAuth } from "../../context/Auth"; import { ScopeSelect } from "./ScopeSelect"; import UserSettingsUI from "./UserSettings"; import { Listbox, Transition } from "@headlessui/react"; -import { ChevronUpDownIcon } from "@heroicons/react/24/outline"; +import { ChevronUpDownIcon, PlusCircleIcon } from "@heroicons/react/24/outline"; import { selectProfileThunk } from "../../redux/thunks/profileAndOrg"; function ConfigPage() { @@ -25,8 +25,8 @@ function ConfigPage() { profiles, selectedProfile, controlServerBetaEnabled, + selectedOrganization, } = useAuth(); - // const profiles = []; const changeProfileId = (id: string) => { dispatch(selectProfileThunk(id)); @@ -102,7 +102,7 @@ function ConfigPage() {
- {selectedProfile?.title} + {selectedProfile?.title ?? "No Assistant Selected"}
{option.title} ))} - {profiles.length === 0 && ( + {hubEnabled && ( { + ideMessenger.post("controlPlane/openUrl", { + path: "new", + orgSlug: selectedOrganization?.slug, + }); + }} > - - No profiles found + + + Create new Assistant )} diff --git a/gui/src/redux/thunks/profileAndOrg.ts b/gui/src/redux/thunks/profileAndOrg.ts index 64e2ee9f5..2ca7382a7 100644 --- a/gui/src/redux/thunks/profileAndOrg.ts +++ b/gui/src/redux/thunks/profileAndOrg.ts @@ -106,6 +106,7 @@ export const selectOrgThunk = createAsyncThunk< // Fallback to Personal (org = null) if (initialId !== newId) { + dispatch(setAvailableProfiles([])); dispatch(setSelectedOrganizationId(newId)); extra.ideMessenger.post("didChangeSelectedOrg", { id: newId, @@ -117,7 +118,7 @@ export const updateOrgsThunk = createAsyncThunk< void, OrganizationDescription[], ThunkApiType ->("session/updateOrgs", async (orgs, { dispatch, extra, getState }) => { +>("session/updateOrgs", async (orgs, { dispatch, getState }) => { const state = getState(); dispatch(setOrganizations(orgs));