import { useRouter } from "next/router"; import { Command } from "cmdk"; // helpers import { commandGroups } from "components/command-palette"; // types import { IWorkspaceSearchResults } from "types"; type Props = { closePalette: () => void; results: IWorkspaceSearchResults; }; export const CommandPaletteSearchResults: React.FC = (props) => { const { closePalette, results } = props; const router = useRouter(); return ( <> {Object.keys(results.results).map((key) => { const section = (results.results as any)[key]; const currentSection = commandGroups[key]; if (section.length > 0) { return ( {section.map((item: any) => ( { closePalette(); router.push(currentSection.path(item)); }} value={`${key}-${item?.id}-${item.name}-${item.project__identifier ?? ""}-${item.sequence_id ?? ""}`} className="focus:outline-none" >
{currentSection.icon}

{currentSection.itemName(item)}

))}
); } })} ); };