import { hasPermission, type Permission, type PermissionScope, type Role } from "@cms/content/rbac" import Link from "next/link" import type { ReactNode } from "react" import { LogoutButton } from "@/app/logout-button" import { AdminLocaleSwitcher } from "@/components/admin-locale-switcher" import { getBuildInfo } from "@/lib/build-info" type AdminShellProps = { role: Role activePath: string badge: string title: string description: string actions?: ReactNode children: ReactNode } type NavItem = { href: string label: string permission: Permission scope: PermissionScope } const navItems: NavItem[] = [ { href: "/", label: "Dashboard", permission: "dashboard:read", scope: "global" }, { href: "/pages", label: "Pages", permission: "pages:read", scope: "team" }, { href: "/navigation", label: "Navigation", permission: "navigation:read", scope: "team" }, { href: "/media", label: "Media", permission: "media:read", scope: "team" }, { href: "/portfolio", label: "Portfolio", permission: "media:read", scope: "team" }, { href: "/users", label: "Users", permission: "users:read", scope: "own" }, { href: "/commissions", label: "Commissions", permission: "commissions:read", scope: "own" }, { href: "/settings", label: "Settings", permission: "users:manage_roles", scope: "global" }, { href: "/todo", label: "Roadmap", permission: "roadmap:read", scope: "global" }, ] function navItemClass(active: boolean): string { if (active) { return "bg-neutral-900 text-white border-neutral-900" } return "bg-white text-neutral-700 border-neutral-300 hover:bg-neutral-100" } function isActiveRoute(activePath: string, href: string): boolean { if (href === "/") { return activePath === "/" } return activePath === href || activePath.startsWith(`${href}/`) } export function AdminShell({ role, activePath, badge, title, description, actions, children, }: AdminShellProps) { const buildInfo = getBuildInfo() return (
{badge}
{description}
{actions ?