"use client" import type React from "react" import { useEffect, useState } from "react" import { usePathname } from "next/navigation" import { cn } from "@/lib/utils" import { Sidebar } from "@/components/sidebar" import { hasPathPermission, getUserRole } from "@/lib/permissions" import { Button } from "@/components/ui/button" import { ShieldX } from "lucide-react" import Link from "next/link" interface DashboardShellProps extends React.HTMLAttributes {} export function DashboardShell({ children, className, ...props }: DashboardShellProps) { const pathname = usePathname() const [allowed, setAllowed] = useState(null) useEffect(() => { setAllowed(hasPathPermission(pathname)) }, [pathname]) const showAccessDenied = allowed === false return (
{showAccessDenied ? (

无访问权限

您当前的角色({getUserRole()})没有访问此页面的权限

请联系超级管理员获取相应权限

) : ( children )}
) }