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

View File

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