1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-06-14 01:16:17 +02:00

chore: fix command bar missing icons in quick suggestions (#7522)

This commit is contained in:
David Leek 2024-07-03 09:41:12 +02:00 committed by GitHub
parent a463e8b1e6
commit 06971375cb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -14,6 +14,8 @@ import {
IconRenderer, IconRenderer,
StyledProjectIcon, StyledProjectIcon,
} from 'component/layout/MainLayout/NavigationSidebar/IconRenderer'; } from 'component/layout/MainLayout/NavigationSidebar/IconRenderer';
import InsightsIcon from '@mui/icons-material/Insights';
import PlaygroundIcon from '@mui/icons-material/AutoFixNormal';
import { TooltipResolver } from 'component/common/TooltipResolver/TooltipResolver'; import { TooltipResolver } from 'component/common/TooltipResolver/TooltipResolver';
import { usePlausibleTracker } from 'hooks/usePlausibleTracker'; import { usePlausibleTracker } from 'hooks/usePlausibleTracker';
import useProjectOverview from 'hooks/api/getters/useProjectOverview/useProjectOverview'; import useProjectOverview from 'hooks/api/getters/useProjectOverview/useProjectOverview';
@ -48,6 +50,20 @@ export interface CommandResultGroupItem {
description?: string | null; description?: string | null;
} }
const ButtonItemIcon = ({ path }: { path: string }) => {
if (path === '/projects') {
return <StyledProjectIcon />;
}
if (path === '/playground') {
return <PlaygroundIcon />;
}
if (path === '/insights') {
return <InsightsIcon />;
}
return <IconRenderer path={path} />;
};
export const RecentlyVisitedPathButton = ({ export const RecentlyVisitedPathButton = ({
path, path,
key, key,
@ -76,11 +92,7 @@ export const RecentlyVisitedPathButton = ({
onClick={onClick} onClick={onClick}
> >
<StyledListItemIcon> <StyledListItemIcon>
<ConditionallyRender <ButtonItemIcon path={path} />
condition={path === '/projects'}
show={<StyledProjectIcon />}
elseShow={<IconRenderer path={path} />}
/>
</StyledListItemIcon> </StyledListItemIcon>
<StyledListItemText> <StyledListItemText>
<StyledButtonTypography color='textPrimary'> <StyledButtonTypography color='textPrimary'>