mirror of
https://github.com/Sea-Haven-Industries/shoc-frontend-new.git
synced 2026-09-30 08:03:13 +00:00
18 lines
738 B
TypeScript
18 lines
738 B
TypeScript
|
|
import { useUpliftsCanApprove } from "@/domain/uplifts/use-cases/use-uplifts-can-approve";
|
||
|
|
import { getNavGroups, type NavGroup } from "@/config/menu";
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Sidebar groups for the signed-in user. The APPROVALS group appears only
|
||
|
|
* when the backend's can-approve answer (UpliftService tier-role rule, the
|
||
|
|
* same authority behind uplift approve/reject) is true for either tier.
|
||
|
|
* Loading and error states stay closed so the entry never flashes for a
|
||
|
|
* user the backend would refuse.
|
||
|
|
*/
|
||
|
|
export function useNavGroups(): NavGroup[] {
|
||
|
|
const tier1 = useUpliftsCanApprove(1);
|
||
|
|
const tier2 = useUpliftsCanApprove(2);
|
||
|
|
const canReviewUplifts = tier1.data === true || tier2.data === true;
|
||
|
|
|
||
|
|
return getNavGroups({ canReviewUplifts });
|
||
|
|
}
|