From ecd2693cfeae02d346d5b9b9c85df1b14efa0a6f Mon Sep 17 00:00:00 2001 From: andreas-unleash Date: Mon, 11 Mar 2024 10:31:03 +0200 Subject: [PATCH] fix: insights navigation (#6473) What it says on the tin Also adds the beta badge Closes # [1-2152](https://linear.app/unleash/issue/1-2152/adjust-insights-placement-in-navigation) Screenshot 2024-03-08 at 16 14 59 --------- Signed-off-by: andreas-unleash --- frontend/src/component/menu/Header/Header.tsx | 43 ++++++++++++++++--- .../__snapshots__/routes.test.tsx.snap | 1 - frontend/src/component/menu/routes.ts | 2 +- 3 files changed, 38 insertions(+), 8 deletions(-) diff --git a/frontend/src/component/menu/Header/Header.tsx b/frontend/src/component/menu/Header/Header.tsx index ae860c6a1e..aa5a8f4873 100644 --- a/frontend/src/component/menu/Header/Header.tsx +++ b/frontend/src/component/menu/Header/Header.tsx @@ -39,6 +39,8 @@ import { Notifications } from 'component/common/Notifications/Notifications'; import { useAdminRoutes } from 'component/admin/useAdminRoutes'; import InviteLinkButton from './InviteLink/InviteLinkButton/InviteLinkButton'; import { useUiFlag } from 'hooks/useUiFlag'; +import { INavigationMenuItem } from '../../../interfaces/route'; +import { Badge } from '../../common/Badge/Badge'; const StyledHeader = styled(AppBar)(({ theme }) => ({ backgroundColor: theme.palette.background.paper, @@ -128,12 +130,38 @@ const StyledAdvancedNavButton = styled('button')(({ theme }) => ({ cursor: 'pointer', })); +const StyledSpan = styled('span')({ + height: '16px', + paddingBottom: 16, +}); + +const StyledBadge = styled(Badge)({ + height: '16px', + maxHeight: '16px', + padding: 0.25, + marginBottom: 0, +}); + const styledIconProps = (theme: Theme) => ({ color: theme.palette.neutral.main, }); const StyledLink = styled(Link)(({ theme }) => focusable(theme)); +const StyledLinkWithBetaBagde = ({ + title, + to, +}: { title: string; to: string }) => ( + +
+ {title}{' '} + + Beta + +
+
+); + const StyledIconButton = styled(IconButton)<{ component?: 'a' | 'button'; href?: string; @@ -248,15 +276,18 @@ const Header: VFC = () => { - Insights - } - /> Projects Search Playground + + } + /> setConfigRef(e.currentTarget)} aria-controls={configRef ? configId : undefined} diff --git a/frontend/src/component/menu/__tests__/__snapshots__/routes.test.tsx.snap b/frontend/src/component/menu/__tests__/__snapshots__/routes.test.tsx.snap index d474d0202d..933ef8a36a 100644 --- a/frontend/src/component/menu/__tests__/__snapshots__/routes.test.tsx.snap +++ b/frontend/src/component/menu/__tests__/__snapshots__/routes.test.tsx.snap @@ -15,7 +15,6 @@ exports[`returns all baseRoutes 1`] = ` "enterprise": false, "flag": "executiveDashboard", "menu": { - "advanced": true, "mobile": true, }, "path": "/insights", diff --git a/frontend/src/component/menu/routes.ts b/frontend/src/component/menu/routes.ts index d0d7aaaa0c..12e00dc85b 100644 --- a/frontend/src/component/menu/routes.ts +++ b/frontend/src/component/menu/routes.ts @@ -66,7 +66,7 @@ export const routes: IRoute[] = [ title: 'Insights', component: ExecutiveDashboard, type: 'protected', - menu: { mobile: true, advanced: true }, + menu: { mobile: true }, flag: 'executiveDashboard', enterprise: false, },