@@ -13,7 +13,7 @@ import { countries } from "countries-list";
13
13
import gitpodIcon from "./icons/gitpod.svg" ;
14
14
import { getGitpodService , gitpodHostUrl } from "./service/service" ;
15
15
import { UserContext } from "./user-context" ;
16
- import { TeamsContext , getCurrentTeam } from "./teams/teams-context" ;
16
+ import { TeamsContext , getCurrentTeam , getSelectedTeamSlug } from "./teams/teams-context" ;
17
17
import getSettingsMenu from "./settings/settings-menu" ;
18
18
import { getAdminMenu } from "./admin/admin-menu" ;
19
19
import ContextMenu from "./components/ContextMenu" ;
@@ -92,13 +92,6 @@ export default function Menu() {
92
92
93
93
const userFullName = user ?. fullName || user ?. name || "..." ;
94
94
95
- {
96
- // updating last team selection
97
- try {
98
- localStorage . setItem ( "team-selection" , team ? team . slug : "" ) ;
99
- } catch { }
100
- }
101
-
102
95
// Hide most of the top menu when in a full-page form.
103
96
const isMinimalUI = inResource ( location . pathname , [ "new" , "teams/new" , "open" ] ) ;
104
97
const isWorkspacesUI = inResource ( location . pathname , [ "workspaces" ] ) ;
@@ -260,33 +253,23 @@ export default function Menu() {
260
253
const onFeedbackFormClose = ( ) => {
261
254
setFeedbackFormVisible ( false ) ;
262
255
} ;
256
+ const isTeamLevelActive = ! projectSlug && ! isWorkspacesUI && ! isAdminUI && teamOrUserSlug ;
263
257
const renderTeamMenu = ( ) => {
264
258
const classes =
265
259
"flex h-full text-base py-0 " +
266
- ( ! projectSlug && ! isWorkspacesUI && ! isAdminUI && teamOrUserSlug
267
- ? "text-gray-50 bg-gray-800 dark:text -gray-900 dark:bg -gray-50 border-gray-700"
268
- : "text-gray-500 bg-gray-50 dark:bg-gray-800 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700 dark:border-gray-700" ) ;
260
+ ( isTeamLevelActive
261
+ ? "text-gray-50 bg-gray-800 dark:bg -gray-50 dark:text -gray-900 border-gray-700 dark:border-gray-200 "
262
+ : "text-gray-500 bg-gray-50 dark:bg-gray-800 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700 dark:border-gray-700" ) ;
269
263
return (
270
264
< div className = "flex p-1 pl-3" >
271
- { projectSlug && (
272
- < Link to = { team ? `/t/${ team . slug } /projects` : `/projects` } >
273
- < span
274
- className = { `${ classes } rounded-tl-2xl rounded-bl-2xl dark:border-gray-700 border-r pl-3 pr-2 py-1 bg-gray-50 font-semibold` }
275
- >
276
- { team ?. name || userFullName }
277
- </ span >
278
- </ Link >
279
- ) }
280
- { ! projectSlug && (
281
- < Link to = { team ? `/t/${ team . slug } /projects` : `/projects` } >
282
- < span
283
- className = { `${ classes } rounded-tl-2xl rounded-bl-2xl dark:border-gray-200 border-r pl-3 pr-2 py-1 bg-gray-50 font-semibold` }
284
- >
285
- { team ?. name || userFullName }
286
- </ span >
287
- </ Link >
288
- ) }
289
- < div className = { `${ classes } rounded-tr-2xl rounded-br-2xl dark:border-gray-700 px-1 bg-gray-50` } >
265
+ < Link to = { getSelectedTeamSlug ( ) ? `/t/${ getSelectedTeamSlug ( ) } /projects` : `/projects` } >
266
+ < span
267
+ className = { `${ classes } rounded-tl-2xl rounded-bl-2xl border-r pl-3 pr-2 py-1 bg-gray-50 font-semibold` }
268
+ >
269
+ { teams ?. find ( ( t ) => t . slug === getSelectedTeamSlug ( ) ) ?. name || userFullName }
270
+ </ span >
271
+ </ Link >
272
+ < div className = { `${ classes } rounded-tr-2xl rounded-br-2xl px-1` } >
290
273
< ContextMenu
291
274
customClasses = "w-64 left-0"
292
275
menuEntries = { [
@@ -300,7 +283,7 @@ export default function Menu() {
300
283
< span className = "" > Personal Account</ span >
301
284
</ div >
302
285
) ,
303
- active : ! team ,
286
+ active : getSelectedTeamSlug ( ) === "" ,
304
287
separator : true ,
305
288
link : "/projects" ,
306
289
} ,
@@ -321,7 +304,7 @@ export default function Menu() {
321
304
</ span >
322
305
</ div >
323
306
) ,
324
- active : team && team . id === t . id ,
307
+ active : getSelectedTeamSlug ( ) === t . slug ,
325
308
separator : true ,
326
309
link : `/t/${ t . slug } ` ,
327
310
} ) )
0 commit comments