-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[dashboard] keep team selection #13318
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,7 +13,7 @@ import { countries } from "countries-list"; | |
import gitpodIcon from "./icons/gitpod.svg"; | ||
import { getGitpodService, gitpodHostUrl } from "./service/service"; | ||
import { UserContext } from "./user-context"; | ||
import { TeamsContext, getCurrentTeam } from "./teams/teams-context"; | ||
import { TeamsContext, getCurrentTeam, getSelectedTeamSlug } from "./teams/teams-context"; | ||
import getSettingsMenu from "./settings/settings-menu"; | ||
import { getAdminMenu } from "./admin/admin-menu"; | ||
import ContextMenu from "./components/ContextMenu"; | ||
|
@@ -92,13 +92,6 @@ export default function Menu() { | |
|
||
const userFullName = user?.fullName || user?.name || "..."; | ||
|
||
{ | ||
// updating last team selection | ||
try { | ||
localStorage.setItem("team-selection", team ? team.slug : ""); | ||
} catch {} | ||
} | ||
|
||
// Hide most of the top menu when in a full-page form. | ||
const isMinimalUI = inResource(location.pathname, ["new", "teams/new", "open"]); | ||
const isWorkspacesUI = inResource(location.pathname, ["workspaces"]); | ||
|
@@ -260,33 +253,23 @@ export default function Menu() { | |
const onFeedbackFormClose = () => { | ||
setFeedbackFormVisible(false); | ||
}; | ||
const isTeamLevelActive = !projectSlug && !isWorkspacesUI && !isAdminUI && teamOrUserSlug; | ||
const renderTeamMenu = () => { | ||
const classes = | ||
"flex h-full text-base py-0 " + | ||
(!projectSlug && !isWorkspacesUI && !isAdminUI && teamOrUserSlug | ||
? "text-gray-50 bg-gray-800 dark:text-gray-900 dark:bg-gray-50 border-gray-700" | ||
: "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"); | ||
(isTeamLevelActive | ||
? "text-gray-50 bg-gray-800 dark:bg-gray-50 dark:text-gray-900 border-gray-700 dark:border-gray-200" | ||
: "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"); | ||
return ( | ||
<div className="flex p-1 pl-3"> | ||
{projectSlug && ( | ||
<Link to={team ? `/t/${team.slug}/projects` : `/projects`}> | ||
<span | ||
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`} | ||
> | ||
{team?.name || userFullName} | ||
</span> | ||
</Link> | ||
)} | ||
{!projectSlug && ( | ||
<Link to={team ? `/t/${team.slug}/projects` : `/projects`}> | ||
<span | ||
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`} | ||
> | ||
{team?.name || userFullName} | ||
</span> | ||
</Link> | ||
)} | ||
<div className={`${classes} rounded-tr-2xl rounded-br-2xl dark:border-gray-700 px-1 bg-gray-50`}> | ||
<Link to={getSelectedTeamSlug() ? `/t/${getSelectedTeamSlug()}/projects` : `/projects`}> | ||
<span | ||
className={`${classes} rounded-tl-2xl rounded-bl-2xl border-r pl-3 pr-2 py-1 bg-gray-50 font-semibold`} | ||
> | ||
{teams?.find((t) => t.slug === getSelectedTeamSlug())?.name || userFullName} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. issue: Going from workspaces back to the team-scope always goes back to the personal account projects, regardless what the selected team scope is. This should get you back to the projects of the last selected team, right? |
||
</span> | ||
</Link> | ||
<div className={`${classes} rounded-tr-2xl rounded-br-2xl px-1`}> | ||
<ContextMenu | ||
customClasses="w-64 left-0" | ||
menuEntries={[ | ||
|
@@ -300,7 +283,7 @@ export default function Menu() { | |
<span className="">Personal Account</span> | ||
</div> | ||
), | ||
active: !team, | ||
active: getSelectedTeamSlug() === "", | ||
separator: true, | ||
link: "/projects", | ||
}, | ||
|
@@ -321,7 +304,7 @@ export default function Menu() { | |
</span> | ||
</div> | ||
), | ||
active: team && team.id === t.id, | ||
active: getSelectedTeamSlug() === t.slug, | ||
separator: true, | ||
link: `/t/${t.slug}`, | ||
})) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
issue: I can no longer select personal account, although you get redirected to the projects of the personal account when you select your personal account from the dropdown. 😭