mirror of
https://github.com/Unleash/unleash.git
synced 2025-07-12 13:48:35 +02:00
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) <img width="902" alt="Screenshot 2024-03-08 at 16 14 59" src="https://github.com/Unleash/unleash/assets/104830839/3e67cba3-fb0f-438c-9e53-e51d923a373e"> --------- Signed-off-by: andreas-unleash <andreas@getunleash.ai>
This commit is contained in:
parent
2a3959082c
commit
ecd2693cfe
@ -39,6 +39,8 @@ import { Notifications } from 'component/common/Notifications/Notifications';
|
|||||||
import { useAdminRoutes } from 'component/admin/useAdminRoutes';
|
import { useAdminRoutes } from 'component/admin/useAdminRoutes';
|
||||||
import InviteLinkButton from './InviteLink/InviteLinkButton/InviteLinkButton';
|
import InviteLinkButton from './InviteLink/InviteLinkButton/InviteLinkButton';
|
||||||
import { useUiFlag } from 'hooks/useUiFlag';
|
import { useUiFlag } from 'hooks/useUiFlag';
|
||||||
|
import { INavigationMenuItem } from '../../../interfaces/route';
|
||||||
|
import { Badge } from '../../common/Badge/Badge';
|
||||||
|
|
||||||
const StyledHeader = styled(AppBar)(({ theme }) => ({
|
const StyledHeader = styled(AppBar)(({ theme }) => ({
|
||||||
backgroundColor: theme.palette.background.paper,
|
backgroundColor: theme.palette.background.paper,
|
||||||
@ -128,12 +130,38 @@ const StyledAdvancedNavButton = styled('button')(({ theme }) => ({
|
|||||||
cursor: 'pointer',
|
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) => ({
|
const styledIconProps = (theme: Theme) => ({
|
||||||
color: theme.palette.neutral.main,
|
color: theme.palette.neutral.main,
|
||||||
});
|
});
|
||||||
|
|
||||||
const StyledLink = styled(Link)(({ theme }) => focusable(theme));
|
const StyledLink = styled(Link)(({ theme }) => focusable(theme));
|
||||||
|
|
||||||
|
const StyledLinkWithBetaBagde = ({
|
||||||
|
title,
|
||||||
|
to,
|
||||||
|
}: { title: string; to: string }) => (
|
||||||
|
<StyledLink to={to} sx={{ margin: 0 }}>
|
||||||
|
<div>
|
||||||
|
<span>{title}</span>{' '}
|
||||||
|
<StyledSpan>
|
||||||
|
<StyledBadge color='success'>Beta</StyledBadge>
|
||||||
|
</StyledSpan>
|
||||||
|
</div>
|
||||||
|
</StyledLink>
|
||||||
|
);
|
||||||
|
|
||||||
const StyledIconButton = styled(IconButton)<{
|
const StyledIconButton = styled(IconButton)<{
|
||||||
component?: 'a' | 'button';
|
component?: 'a' | 'button';
|
||||||
href?: string;
|
href?: string;
|
||||||
@ -248,15 +276,18 @@ const Header: VFC = () => {
|
|||||||
|
|
||||||
<StyledNav>
|
<StyledNav>
|
||||||
<StyledLinks>
|
<StyledLinks>
|
||||||
<ConditionallyRender
|
|
||||||
condition={insightsDashboard}
|
|
||||||
show={
|
|
||||||
<StyledLink to='/insights'>Insights</StyledLink>
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
<StyledLink to='/projects'>Projects</StyledLink>
|
<StyledLink to='/projects'>Projects</StyledLink>
|
||||||
<StyledLink to={'/search'}>Search</StyledLink>
|
<StyledLink to={'/search'}>Search</StyledLink>
|
||||||
<StyledLink to='/playground'>Playground</StyledLink>
|
<StyledLink to='/playground'>Playground</StyledLink>
|
||||||
|
<ConditionallyRender
|
||||||
|
condition={insightsDashboard}
|
||||||
|
show={
|
||||||
|
<StyledLinkWithBetaBagde
|
||||||
|
to={'/insights'}
|
||||||
|
title={'Insights'}
|
||||||
|
/>
|
||||||
|
}
|
||||||
|
/>
|
||||||
<StyledAdvancedNavButton
|
<StyledAdvancedNavButton
|
||||||
onClick={(e) => setConfigRef(e.currentTarget)}
|
onClick={(e) => setConfigRef(e.currentTarget)}
|
||||||
aria-controls={configRef ? configId : undefined}
|
aria-controls={configRef ? configId : undefined}
|
||||||
|
@ -15,7 +15,6 @@ exports[`returns all baseRoutes 1`] = `
|
|||||||
"enterprise": false,
|
"enterprise": false,
|
||||||
"flag": "executiveDashboard",
|
"flag": "executiveDashboard",
|
||||||
"menu": {
|
"menu": {
|
||||||
"advanced": true,
|
|
||||||
"mobile": true,
|
"mobile": true,
|
||||||
},
|
},
|
||||||
"path": "/insights",
|
"path": "/insights",
|
||||||
|
@ -66,7 +66,7 @@ export const routes: IRoute[] = [
|
|||||||
title: 'Insights',
|
title: 'Insights',
|
||||||
component: ExecutiveDashboard,
|
component: ExecutiveDashboard,
|
||||||
type: 'protected',
|
type: 'protected',
|
||||||
menu: { mobile: true, advanced: true },
|
menu: { mobile: true },
|
||||||
flag: 'executiveDashboard',
|
flag: 'executiveDashboard',
|
||||||
enterprise: false,
|
enterprise: false,
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user