Skip to content

Commit

Permalink
chore: adds icons for insights and playground paths to recently visited
Browse files Browse the repository at this point in the history
  • Loading branch information
daveleek committed Jun 17, 2024
1 parent c4e2159 commit 3ac6fc5
Showing 1 changed file with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,13 @@ import {
IconRenderer,
StyledProjectIcon,
} 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 { Theme } from '@mui/material/styles/createTheme';
import useProjectOverview from 'hooks/api/getters/useProjectOverview/useProjectOverview';
import { ConditionallyRender } from 'component/common/ConditionallyRender/ConditionallyRender';
import type { ReactElement } from 'react-markdown/lib/react-markdown';

const listItemButtonStyle = (theme: Theme) => ({
borderRadius: theme.spacing(0.5),
Expand All @@ -39,6 +42,12 @@ const StyledListItemText = styled(ListItemText)(({ theme }) => ({
margin: 0,
}));

const overridePathIcons: Record<string, () => ReactElement> = {
'/insights': () => <InsightsIcon />,
'/playground': () => <PlaygroundIcon />,
'/projects': () => <StyledProjectIcon />,
};

const toListItemButton = (
item: LastViewedPage,
routes: Record<string, { path: string; route: string; title: string }>,
Expand Down Expand Up @@ -107,8 +116,8 @@ const RecentlyVisitedPathButton = ({
>
<StyledListItemIcon>
<ConditionallyRender
condition={path === '/projects'}
show={<StyledProjectIcon />}
condition={overridePathIcons[path] !== undefined}
show={overridePathIcons[path]}
elseShow={<IconRenderer path={path} />}
/>
</StyledListItemIcon>
Expand Down

0 comments on commit 3ac6fc5

Please sign in to comment.