MCPcopy
hub / github.com/nowork-studio/NotFair / pick

Function pick

notfair-cmo/src/components/project-switcher.tsx:39–50  ·  view source on GitHub ↗
(slug: string)

Source from the content-addressed store, hash-verified

37 const active = projects.find((p) => p.slug === activeSlug) ?? null;
38
39 function pick(slug: string) {
40 if (slug === activeSlug) return;
41 const subPath = subPathFromPathname(pathname, activeSlug);
42 start(async () => {
43 const result = await switchProjectAction(slug);
44 if (!result.ok) {
45 toast.error(result.error);
46 return;
47 }
48 router.push(projectHref(slug, subPath));
49 });
50 }
51
52 return (
53 <DropdownMenu>

Callers 1

ProjectSwitcherFunction · 0.85

Calls 4

subPathFromPathnameFunction · 0.90
switchProjectActionFunction · 0.90
projectHrefFunction · 0.90
startFunction · 0.70

Tested by

no test coverage detected