From 6ed143226bffdf66e4513373a087b96ff7eab454 Mon Sep 17 00:00:00 2001 From: George Tsiolis Date: Fri, 27 May 2022 17:44:04 +0000 Subject: [PATCH] Update dashboard navigation --- components/dashboard/src/Menu.tsx | 128 +++++++++++------- .../dashboard/src/components/PillMenuItem.tsx | 6 +- .../dashboard/src/icons/CaretUpDown.svg | 3 - 3 files changed, 81 insertions(+), 56 deletions(-) delete mode 100644 components/dashboard/src/icons/CaretUpDown.svg diff --git a/components/dashboard/src/Menu.tsx b/components/dashboard/src/Menu.tsx index 2d7207fb3529ab..8e926a6743814e 100644 --- a/components/dashboard/src/Menu.tsx +++ b/components/dashboard/src/Menu.tsx @@ -11,8 +11,6 @@ import { useLocation, useRouteMatch } from "react-router"; import { Location } from "history"; import { countries } from "countries-list"; import gitpodIcon from "./icons/gitpod.svg"; -import CaretDown from "./icons/CaretDown.svg"; -import CaretUpDown from "./icons/CaretUpDown.svg"; import { getGitpodService, gitpodHostUrl } from "./service/service"; import { UserContext } from "./user-context"; import { TeamsContext, getCurrentTeam } from "./teams/teams-context"; @@ -108,6 +106,8 @@ export default function Menu() { // Hide most of the top menu when in a full-page form. const isMinimalUI = ["/new", "/teams/new", "/open"].includes(location.pathname); + const isWorkspacesUI = ["/workspaces"].includes(location.pathname); + const isAdminUI = window.location.pathname.startsWith("/admin"); const [teamMembers, setTeamMembers] = useState>({}); useEffect(() => { @@ -228,11 +228,6 @@ export default function Menu() { } // User menu return [ - { - title: "Workspaces", - link: "/workspaces", - alternatives: ["/"], - }, { title: "Projects", link: "/projects", @@ -255,8 +250,9 @@ export default function Menu() { ] : []), { - title: "Docs", - link: "https://www.gitpod.io/docs/", + title: "Workspaces", + link: "/workspaces", + alternatives: ["/"], }, ]; @@ -268,25 +264,39 @@ export default function Menu() { setFeedbackFormVisible(false); }; 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"); return ( -
+
{projectSlug && ( -
- - - {team?.name || userFullName} - - -
+ + + {team?.name || userFullName} + + )} -
+ {!projectSlug && ( + + + {team?.name || userFullName} + + + )} +
+
{userFullName} @@ -295,7 +305,7 @@ export default function Menu() { ), active: !team, separator: true, - link: "/", + link: "/projects", }, ...(teams || []) .map((t) => ({ @@ -343,35 +353,50 @@ export default function Menu() { }, ]} > -
- {!projectSlug && ( - - {team?.name || userFullName} - - )} - +
+ + + Toggle team selection menu +
- {projectSlug && ( -
- - - {project?.name} - - -
+ {projectSlug && !prebuildId && !isAdminUI && ( + + + {project?.name} + + )} {prebuildId && ( -
- - {prebuildId} + + + {project?.name} + + + )} + {prebuildId && ( +
+
+ + + +
+ + + {prebuildId.substring(0, 8).trimEnd()} + +
)}
@@ -380,11 +405,8 @@ export default function Menu() { return ( <> -
-
+
+
Gitpod's logo @@ -393,7 +415,7 @@ export default function Menu() {
{isFeedbackFormVisible && }
- {!isMinimalUI && !prebuildId && ( + {!isMinimalUI && !prebuildId && !isWorkspacesUI && !isAdminUI && (