command palette tweaks

This commit is contained in:
miloschwartz
2026-07-07 21:55:15 -04:00
parent 1e7863ce4f
commit d082de3d88
12 changed files with 182 additions and 39 deletions
@@ -0,0 +1,24 @@
"use client";
import { useUserContext } from "@app/hooks/useUserContext";
import { ListUserOrgsResponse } from "@server/routers/org";
import { usePathname } from "next/navigation";
export function useCanUseCommandPalette(
orgId?: string,
orgs?: ListUserOrgsResponse["orgs"]
) {
const pathname = usePathname();
const { user } = useUserContext();
if (pathname?.startsWith("/admin")) {
return user.serverAdmin;
}
if (!orgId) {
return false;
}
const currentOrg = orgs?.find((org) => org.orgId === orgId);
return Boolean(currentOrg?.isAdmin || currentOrg?.isOwner);
}