"use client"; import { useMemo } from "react"; import { useAdminAuth } from "@/app/lib/AdminAuthContext"; import { sidebarFromAclMenu, type SidebarLink } from "@/app/lib/aclSidebar"; /** * Sidebar entries derived from the signed-in user's live aclMenu (via * AdminAuthContext). Task 6 wires this directly into the sidebar shell * component in place of the static src/components/app/nav-config.ts list. * Order and grouping follow the aclMenu tree (siblings by module id); */ export function useAclSidebar(): SidebarLink[] { const { aclMenu, isSuper } = useAdminAuth(); // Companies is gated by isSuper, not by a module, so it is not in the aclMenu tree. return useMemo( () => [ ...sidebarFromAclMenu(aclMenu), ...(isSuper ? [{ name: "BO_COMPANIES", url: "/companies", iconName: "Store", children: [] }] : []), ], [aclMenu, isSuper], ); }