1- import { ArrowPathIcon , PlusIcon } from "@heroicons/react/24/outline" ;
1+ import {
2+ ArrowPathIcon ,
3+ ArrowRightEndOnRectangleIcon ,
4+ ArrowRightStartOnRectangleIcon ,
5+ PlusIcon ,
6+ } from "@heroicons/react/24/outline" ;
27import { AuthType , isOnPremSession } from "core/control-plane/AuthTypes" ;
38import { useContext , useEffect , useRef } from "react" ;
49import { useAuth } from "../../context/Auth" ;
@@ -10,7 +15,7 @@ import {
1015} from "../../redux/slices/profilesSlice" ;
1116import { getMetaKeyLabel , isMetaEquivalentKeyPressed } from "../../util" ;
1217import { cn } from "../../util/cn" ;
13- import { useLump } from "../mainInput/Lump/LumpContext " ;
18+ import { ToolTip } from "../gui/Tooltip " ;
1419import {
1520 Listbox ,
1621 ListboxOption ,
@@ -27,7 +32,6 @@ export function AssistantAndOrgListbox() {
2732 const listboxRef = useRef < HTMLDivElement > ( null ) ;
2833 const currentOrg = useAppSelector ( selectCurrentOrg ) ;
2934 const ideMessenger = useContext ( IdeMessengerContext ) ;
30- const { isToolbarExpanded } = useLump ( ) ;
3135 const {
3236 profiles,
3337 selectedProfile,
@@ -38,7 +42,6 @@ export function AssistantAndOrgListbox() {
3842 refreshProfiles,
3943 } = useAuth ( ) ;
4044 const configLoading = useAppSelector ( ( store ) => store . config . loading ) ;
41- const smallFont = useFontSize ( - 3 ) ;
4245 const tinyFont = useFontSize ( - 4 ) ;
4346 const shouldRenderOrgInfo =
4447 session && organizations . length > 1 && ! isOnPremSession ( session ) ;
@@ -50,10 +53,14 @@ export function AssistantAndOrgListbox() {
5053 }
5154
5255 function onNewAssistant ( ) {
53- void ideMessenger . request ( "controlPlane/openUrl" , {
54- path : "/new" ,
55- orgSlug : currentOrg ?. slug ,
56- } ) ;
56+ if ( session ) {
57+ void ideMessenger . request ( "controlPlane/openUrl" , {
58+ path : "/new" ,
59+ orgSlug : currentOrg ?. slug ,
60+ } ) ;
61+ } else {
62+ void ideMessenger . request ( "config/newAssistantFile" , undefined ) ;
63+ }
5764 close ( ) ;
5865 }
5966
@@ -108,12 +115,29 @@ export function AssistantAndOrgListbox() {
108115 < div className = "relative" ref = { listboxRef } >
109116 < SelectedAssistantButton selectedProfile = { selectedProfile } />
110117 < Transition >
111- < ListboxOptions className = "-translate-x-1.5 pb-0" >
112- < div className = "border-border border-x-0 border-t-0 border-solid px-2 py-3" >
113- < div className = "flex flex-col gap-2 pb-1 pl-1" >
114- { session && session ?. AUTH_TYPE !== AuthType . OnPrem && (
115- < span className = "text-description-muted flex items-center pb-1" >
116- { session ?. account . id }
118+ < ListboxOptions
119+ className = "-translate-x-1.5 pb-0"
120+ style = { { zIndex : 200 } }
121+ >
122+ < div className = "border-border border-x-0 border-t-0 border-solid px-2 py-2" >
123+ < div className = "flex flex-col gap-2 pl-1" >
124+ { session ? (
125+ < span className = "text-description-muted flex items-center justify-between gap-x-1" >
126+ { session ?. AUTH_TYPE !== AuthType . OnPrem &&
127+ session ?. account . id }
128+ < ArrowRightStartOnRectangleIcon
129+ className = "h-3 w-3 cursor-pointer hover:brightness-125"
130+ onClick = { onLogout }
131+ data-tooltip-id = "logout-tooltip"
132+ />
133+ < ToolTip id = "logout-tooltip" > Logout</ ToolTip >
134+ </ span >
135+ ) : (
136+ < span
137+ className = "text-description-muted flex cursor-pointer items-center justify-end gap-x-1 hover:brightness-125"
138+ onClick = { ( ) => login ( false ) }
139+ >
140+ Log In < ArrowRightEndOnRectangleIcon className = "h-3 w-3" />
117141 </ span >
118142 ) }
119143 { shouldRenderOrgInfo && (
@@ -138,7 +162,7 @@ export function AssistantAndOrgListbox() {
138162 value = "new-assistant"
139163 fontSizeModifier = { - 2 }
140164 className = "border-border border-b px-2 py-1.5"
141- onClick = { session ? onNewAssistant : ( ) => login ( false ) }
165+ onClick = { onNewAssistant }
142166 >
143167 < span
144168 className = "text-description flex flex-row items-center"
@@ -170,22 +194,6 @@ export function AssistantAndOrgListbox() {
170194 </ span >
171195 </ ListboxOption >
172196
173- { session && (
174- < ListboxOption
175- value = "log-out"
176- fontSizeModifier = { - 2 }
177- className = "border-border border-b px-3 py-1.5"
178- onClick = { onLogout }
179- >
180- < div
181- className = "text-description flex flex-row items-center"
182- style = { { fontSize : tinyFont } }
183- >
184- Log out
185- </ div >
186- </ ListboxOption >
187- ) }
188-
189197 < div
190198 className = "text-description border-border flex items-center justify-between gap-1.5 border-x-0 border-b-0 border-t border-solid px-2 py-2"
191199 style = { { fontSize : tinyFont } }
0 commit comments