mirror of
https://github.com/Unleash/unleash.git
synced 2025-09-05 17:53:12 +02:00
chore: adds icons for insights and playground paths to recently visited
This commit is contained in:
parent
c4e2159401
commit
3ac6fc5427
@ -12,10 +12,13 @@ import {
|
|||||||
IconRenderer,
|
IconRenderer,
|
||||||
StyledProjectIcon,
|
StyledProjectIcon,
|
||||||
} from 'component/layout/MainLayout/NavigationSidebar/IconRenderer';
|
} from 'component/layout/MainLayout/NavigationSidebar/IconRenderer';
|
||||||
|
import PlaygroundIcon from '@mui/icons-material/AutoFixNormal';
|
||||||
|
import InsightsIcon from '@mui/icons-material/Insights';
|
||||||
import type { LastViewedPage } from 'hooks/useRecentlyVisited';
|
import type { LastViewedPage } from 'hooks/useRecentlyVisited';
|
||||||
import type { Theme } from '@mui/material/styles/createTheme';
|
import type { Theme } from '@mui/material/styles/createTheme';
|
||||||
import useProjectOverview from 'hooks/api/getters/useProjectOverview/useProjectOverview';
|
import useProjectOverview from 'hooks/api/getters/useProjectOverview/useProjectOverview';
|
||||||
import { ConditionallyRender } from 'component/common/ConditionallyRender/ConditionallyRender';
|
import { ConditionallyRender } from 'component/common/ConditionallyRender/ConditionallyRender';
|
||||||
|
import type { ReactElement } from 'react-markdown/lib/react-markdown';
|
||||||
|
|
||||||
const listItemButtonStyle = (theme: Theme) => ({
|
const listItemButtonStyle = (theme: Theme) => ({
|
||||||
borderRadius: theme.spacing(0.5),
|
borderRadius: theme.spacing(0.5),
|
||||||
@ -39,6 +42,12 @@ const StyledListItemText = styled(ListItemText)(({ theme }) => ({
|
|||||||
margin: 0,
|
margin: 0,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
const overridePathIcons: Record<string, () => ReactElement> = {
|
||||||
|
'/insights': () => <InsightsIcon />,
|
||||||
|
'/playground': () => <PlaygroundIcon />,
|
||||||
|
'/projects': () => <StyledProjectIcon />,
|
||||||
|
};
|
||||||
|
|
||||||
const toListItemButton = (
|
const toListItemButton = (
|
||||||
item: LastViewedPage,
|
item: LastViewedPage,
|
||||||
routes: Record<string, { path: string; route: string; title: string }>,
|
routes: Record<string, { path: string; route: string; title: string }>,
|
||||||
@ -107,8 +116,8 @@ const RecentlyVisitedPathButton = ({
|
|||||||
>
|
>
|
||||||
<StyledListItemIcon>
|
<StyledListItemIcon>
|
||||||
<ConditionallyRender
|
<ConditionallyRender
|
||||||
condition={path === '/projects'}
|
condition={overridePathIcons[path] !== undefined}
|
||||||
show={<StyledProjectIcon />}
|
show={overridePathIcons[path]}
|
||||||
elseShow={<IconRenderer path={path} />}
|
elseShow={<IconRenderer path={path} />}
|
||||||
/>
|
/>
|
||||||
</StyledListItemIcon>
|
</StyledListItemIcon>
|
||||||
|
Loading…
Reference in New Issue
Block a user