diff --git a/apps/web/src/components/CommandPalette.tsx b/apps/web/src/components/CommandPalette.tsx index a24b68e..154e4cd 100644 --- a/apps/web/src/components/CommandPalette.tsx +++ b/apps/web/src/components/CommandPalette.tsx @@ -14,9 +14,11 @@ import { Activity, BarChart3, BookOpen, + Check, Clock, Copy, FileText, + FolderOpen, Layers, LayoutDashboard, Megaphone, @@ -85,7 +87,7 @@ function ShortcutHint({shortcut}: {shortcut: [string, string]}) { export function CommandPalette() { const router = useRouter(); - const {activeProject} = useActiveProject(); + const {activeProject, availableProjects, setActiveProject} = useActiveProject(); const [open, setOpen] = useState(false); const [query, setQuery] = useState(''); const [debouncedQuery, setDebouncedQuery] = useState(''); @@ -188,6 +190,13 @@ export function CommandPalette() { ? CREATE_ACTIONS.filter(a => matches(a.label, query) || matches(a.keywords, query)) : CREATE_ACTIONS; + const filteredProjects = availableProjects.filter(p => matches(p.name, debouncedQuery || query)); + + const switchProject = (project: (typeof availableProjects)[number]) => { + setActiveProject(project); + setOpen(false); + }; + const navigate = (href: string, label: string) => { void router.push(href); addRecentPage({label, href}); @@ -215,7 +224,8 @@ export function CommandPalette() { workflows.length > 0 || segments.length > 0 || filteredNavActions.length > 0 || - filteredCreateActions.length > 0 + filteredCreateActions.length > 0 || + filteredProjects.length > 0 : true; return ( @@ -329,6 +339,27 @@ export function CommandPalette() { )} + {availableProjects.length > 1 && filteredProjects.length > 0 && ( + <> + + {filteredProjects.map(project => ( + switchProject(project)} + > + + {project.name} + {project.id === activeProject?.id && ( + + )} + + ))} + + + + )} + {filteredNavActions.length > 0 && ( {filteredNavActions.map(action => {