import { CommandResultGroup, RecentlyVisitedFeatureButton, RecentlyVisitedPathButton, RecentlyVisitedProjectButton, } from './RecentlyVisited/CommandResultGroup'; import { List } from '@mui/material'; import { useRecentlyVisited, type LastViewedPage, } from 'hooks/useRecentlyVisited'; const toListItemButton = ( item: LastViewedPage, routes: Record, index: number, ) => { const key = `recently-visited-${index}`; if (item.featureId && item.projectId) { return ( ); } if (item.projectId) { return ( ); } if (!item.pathName) return null; const name = routes[item.pathName]?.title ?? item.pathName; return ( ); }; export const CommandRecent = ({ routes, }: { routes: Record; }) => { const { lastVisited } = useRecentlyVisited(); const buttons = lastVisited.map((item, index) => toListItemButton(item, routes, index), ); return ( {buttons} ); };