import { CommandResultGroup, RecentlyVisitedFeatureButton, RecentlyVisitedPathButton, RecentlyVisitedProjectButton, } from './RecentlyVisited/CommandResultGroup'; import { useRecentlyVisited, type LastViewedPage, } from 'hooks/useRecentlyVisited'; const toListItemButton = ( item: LastViewedPage, routes: Record, index: number, onClick: () => void, ) => { 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 CommandQuickSuggestions = ({ routes, onClick, }: { onClick: () => void; routes: Record; }) => { const { lastVisited } = useRecentlyVisited(); const buttons = lastVisited.map((item, index) => toListItemButton(item, routes, index, onClick), ); return ( {buttons} ); };