From 9cb015a7dbaa64e1fe4b46d41a33f4d07561a015 Mon Sep 17 00:00:00 2001 From: Jaanus Sellin Date: Tue, 4 Jun 2024 15:34:23 +0300 Subject: [PATCH] fix: hide insights from sidebar for oss and kill switch (#7270) --- .../NavigationSidebar/NavigationList.tsx | 25 +++++++++++++------ .../NavigationSidebar.test.tsx | 4 +-- 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/frontend/src/component/layout/MainLayout/NavigationSidebar/NavigationList.tsx b/frontend/src/component/layout/MainLayout/NavigationSidebar/NavigationList.tsx index decf8fbf58..18aeb8788c 100644 --- a/frontend/src/component/layout/MainLayout/NavigationSidebar/NavigationList.tsx +++ b/frontend/src/component/layout/MainLayout/NavigationSidebar/NavigationList.tsx @@ -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 ( @@ -177,14 +181,19 @@ export const PrimaryNavigationList: FC<{ > - onClick('/insights')} - selected={activeItem === '/insights'} - > - - + onClick('/insights')} + selected={activeItem === '/insights'} + > + + + } + /> ); }; diff --git a/frontend/src/component/layout/MainLayout/NavigationSidebar/NavigationSidebar.test.tsx b/frontend/src/component/layout/MainLayout/NavigationSidebar/NavigationSidebar.test.tsx index 9c247090f2..4dfc124414 100644 --- a/frontend/src/component/layout/MainLayout/NavigationSidebar/NavigationSidebar.test.tsx +++ b/frontend/src/component/layout/MainLayout/NavigationSidebar/NavigationSidebar.test.tsx @@ -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();