1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-12-22 19:07:54 +01:00

fix: hide insights from sidebar for oss and kill switch (#7270)

This commit is contained in:
Jaanus Sellin 2024-06-04 15:34:23 +03:00 committed by GitHub
parent 1a0a7c18f3
commit 9cb015a7db
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 19 additions and 10 deletions

View File

@ -19,6 +19,8 @@ import AccordionDetails from '@mui/material/AccordionDetails';
import AccordionSummary from '@mui/material/AccordionSummary'; import AccordionSummary from '@mui/material/AccordionSummary';
import ExpandMoreIcon from '@mui/icons-material/ExpandMore'; import ExpandMoreIcon from '@mui/icons-material/ExpandMore';
import FlagIcon from '@mui/icons-material/OutlinedFlag'; import FlagIcon from '@mui/icons-material/OutlinedFlag';
import { useUiFlag } from 'hooks/useUiFlag';
import { ConditionallyRender } from 'component/common/ConditionallyRender/ConditionallyRender';
const StyledBadgeContainer = styled('div')(({ theme }) => ({ const StyledBadgeContainer = styled('div')(({ theme }) => ({
paddingLeft: theme.spacing(2), paddingLeft: theme.spacing(2),
@ -150,6 +152,8 @@ export const PrimaryNavigationList: FC<{
activeItem?: string; activeItem?: string;
}> = ({ mode, onClick, activeItem }) => { }> = ({ mode, onClick, activeItem }) => {
const DynamicListItem = mode === 'mini' ? MiniListItem : FullListItem; const DynamicListItem = mode === 'mini' ? MiniListItem : FullListItem;
const killInsightsDashboard = useUiFlag('killInsightsUI');
const { isOss } = useUiConfig();
return ( return (
<List> <List>
@ -177,14 +181,19 @@ export const PrimaryNavigationList: FC<{
> >
<PlaygroundIcon /> <PlaygroundIcon />
</DynamicListItem> </DynamicListItem>
<DynamicListItem <ConditionallyRender
href='/insights' condition={!killInsightsDashboard && !isOss()}
text='Insights' show={
onClick={() => onClick('/insights')} <DynamicListItem
selected={activeItem === '/insights'} href='/insights'
> text='Insights'
<InsightsIcon /> onClick={() => onClick('/insights')}
</DynamicListItem> selected={activeItem === '/insights'}
>
<InsightsIcon />
</DynamicListItem>
}
/>
</List> </List>
); );
}; };

View File

@ -7,9 +7,9 @@ import { listItemButtonClasses as classes } from '@mui/material/ListItemButton';
import { import {
type LastViewedFlag, type LastViewedFlag,
useLastViewedFlags, useLastViewedFlags,
} from '../../../../hooks/useLastViewedFlags'; } from 'hooks/useLastViewedFlags';
import { type FC, useEffect } from 'react'; import { type FC, useEffect } from 'react';
import { useLastViewedProject } from '../../../../hooks/useLastViewedProject'; import { useLastViewedProject } from 'hooks/useLastViewedProject';
beforeEach(() => { beforeEach(() => {
window.localStorage.clear(); window.localStorage.clear();