diff --git a/app/project/layout.tsx b/app/project/layout.tsx index 11900c0..c78bb51 100644 --- a/app/project/layout.tsx +++ b/app/project/layout.tsx @@ -1,17 +1,28 @@ +"use client" + +import { usePermissionStore } from "@/components/label/store/auth" import AppLayout from "@/components/layout/AppLayout" import { PathnameRecorder } from "@/components/layout/PathnameRecorder" import { componentList, showList } from "@/components/layout/common" +import { useMemo } from "react" -async function getMenu() { - return [...componentList, ...showList] -} +// async function getMenu() { +// return [...componentList, ...showList] +// } + +export default function Layout({ children }: { children: React.ReactNode }) { + const detailInfo = usePermissionStore((s) => s.detailInfo) + + const menu = useMemo(() => { + if (detailInfo?.roles?.length) { + return [...componentList, ...showList] + } else { + return [...componentList, ...showList].filter( + (item) => item.title !== "管理中心" + ) + } + }, [detailInfo?.roles?.length]) -export default async function Layout({ - children, -}: { - children: React.ReactNode -}) { - const menu = await getMenu() return ( {children}