@@ -24,9 +24,10 @@ import {
2424 Settings ,
2525 User ,
2626 Users ,
27+ SwitchSvg ,
2728} from '@/components/icons' ;
2829import { DOCS_URL } from '@/lib/constants' ;
29- import * as url from 'node:url ' ;
30+ import { ArrowRight } from 'lucide-react ' ;
3031
3132export interface TeamsButtonProps {
3233 showText ?: boolean ;
@@ -43,7 +44,7 @@ export function NavButton({ showText = true }: TeamsButtonProps) {
4344 const label = teamId ? team ?. name : user . username ;
4445
4546 const getUrl = ( url : string ) => {
46- return cloudMode ? `${ process . env . cloudUrl } / ${ url } ` : url ;
47+ return cloudMode ? `${ process . env . cloudUrl } ${ url } ` : url ;
4748 } ;
4849
4950 const handleAction = async ( ) => { } ;
@@ -75,42 +76,52 @@ export function NavButton({ showText = true }: TeamsButtonProps) {
7576 </ Pressable >
7677 < Popover placement = "bottom start" >
7778 < Column minWidth = "300px" >
78- < Menu
79- selectionMode = "single"
80- selectedKeys = { selectedKeys }
81- autoFocus = "last"
82- onAction = { handleAction }
83- >
84- < MenuSection title = { formatMessage ( labels . myAccount ) } >
85- < MenuItem id = "user" >
86- < IconLabel icon = { < User /> } label = { user . username } />
87- </ MenuItem >
88- </ MenuSection >
89- < MenuSeparator />
79+ < Menu autoFocus = "last" onAction = { handleAction } >
9080 < SubmenuTrigger >
9181 < MenuItem id = "teams" showChecked = { false } showSubMenuIcon >
92- < IconLabel icon = { < Users /> } label = { formatMessage ( labels . teams ) } />
82+ < IconLabel icon = { < SwitchSvg /> } label = { formatMessage ( labels . switchAccount ) } />
9383 </ MenuItem >
9484 < Popover placement = "right top" >
9585 < Column minWidth = "300px" >
96- < Menu >
86+ < Menu selectionMode = "single" selectedKeys = { selectedKeys } >
87+ < MenuSection title = { formatMessage ( labels . myAccount ) } >
88+ < MenuItem id = "user" href = { getUrl ( '/' ) } >
89+ < IconLabel icon = { < User /> } label = { user . username } />
90+ </ MenuItem >
91+ </ MenuSection >
92+ < MenuSeparator />
9793 < MenuSection title = { formatMessage ( labels . teams ) } >
9894 { user ?. teams ?. map ( ( { id, name } ) => (
99- < MenuItem key = { id } id = { id } >
100- < Row alignItems = "center" gap >
101- < Icon size = "sm" >
102- < Users />
103- </ Icon >
95+ < MenuItem key = { id } id = { id } href = { getUrl ( `/teams/${ id } ` ) } >
96+ < IconLabel icon = { < Users /> } >
10497 < Text wrap = "nowrap" > { name } </ Text >
105- </ Row >
98+ </ IconLabel >
10699 </ MenuItem >
107100 ) ) }
101+ { user ?. teams ?. length === 0 && (
102+ < MenuItem id = "manage-teams" >
103+ < a href = "/settings/teams" style = { { width : '100%' } } >
104+ < Row alignItems = "center" justifyContent = "space-between" gap >
105+ < Text align = "center" > Manage teams</ Text >
106+ < Icon >
107+ < ArrowRight />
108+ </ Icon >
109+ </ Row >
110+ </ a >
111+ </ MenuItem >
112+ ) }
108113 </ MenuSection >
109114 </ Menu >
110115 </ Column >
111116 </ Popover >
112117 </ SubmenuTrigger >
113- < MenuItem id = "settings" icon = { < Settings /> } label = { formatMessage ( labels . settings ) } />
118+ < MenuSeparator />
119+ < MenuItem
120+ id = "settings"
121+ href = { getUrl ( '/settings' ) }
122+ icon = { < Settings /> }
123+ label = { formatMessage ( labels . settings ) }
124+ />
114125 { cloudMode && (
115126 < >
116127 < MenuItem
@@ -132,14 +143,24 @@ export function NavButton({ showText = true }: TeamsButtonProps) {
132143 />
133144 </ >
134145 ) }
135- { user . isAdmin && (
146+ { ! cloudMode && user . isAdmin && (
136147 < >
137148 < MenuSeparator />
138- < MenuItem id = "/admin" icon = { < LockKeyhole /> } label = { formatMessage ( labels . admin ) } />
149+ < MenuItem
150+ id = "/admin"
151+ href = "/admin"
152+ icon = { < LockKeyhole /> }
153+ label = { formatMessage ( labels . admin ) }
154+ />
139155 </ >
140156 ) }
141157 < MenuSeparator />
142- < MenuItem id = "/logout" icon = { < LogOut /> } label = { formatMessage ( labels . logout ) } />
158+ < MenuItem
159+ id = "logout"
160+ href = { getUrl ( '/logout' ) }
161+ icon = { < LogOut /> }
162+ label = { formatMessage ( labels . logout ) }
163+ />
143164 </ Menu >
144165 </ Column >
145166 </ Popover >
0 commit comments