import Link from "next/link"; import { Bell, BedDouble, Building2, ClipboardCheck, Globe2, HeartPulse, LayoutDashboard, ListChecks, Radio, Settings, ShieldAlert, Stethoscope, TabletSmartphone, Users, Wrench, } from "lucide-react"; import type { LucideIcon } from "lucide-react"; import type { Permission, PublicAccount } from "@/modules/core/types"; import { SignOutButton } from "@/modules/auth/components/SignOutButton"; import { UserAvatar } from "@/modules/shared/components/UserAvatar"; type NavItem = { href: string; label: string; icon: LucideIcon; permission?: Permission; }; type NavGroup = { label: string; items: NavItem[]; }; const navGroups: NavGroup[] = [ { label: "运营", items: [ { href: "/app/dashboard", label: "运营看板", icon: LayoutDashboard, }, { href: "/app/elders", label: "老人档案", icon: Users, }, { href: "/app/beds", label: "床位房间", icon: BedDouble, }, { href: "/app/health", label: "健康照护", icon: HeartPulse, }, { href: "/app/care", label: "护理服务", icon: ClipboardCheck, }, { href: "/app/emergency", label: "安全应急", icon: ShieldAlert, }, ], }, { label: "协同", items: [ { href: "/app/devices", label: "设备运维", icon: Wrench, }, { href: "/app/notices", label: "公告通知", icon: Bell, }, { href: "/app/alerts", label: "规则预警", icon: Radio, }, { href: "/app/family", label: "家属服务", icon: TabletSmartphone, }, ], }, { label: "系统设置", items: [ { href: "/app/settings/global", label: "全局配置", icon: Globe2, permission: "platform:manage", }, { href: "/app/settings/organizations", label: "机构管理", icon: Building2, permission: "organization:read", }, { href: "/app/settings/users", label: "用户管理", icon: Users, permission: "account:read", }, { href: "/app/settings/roles", label: "角色权限", icon: Settings, permission: "role:read", }, { href: "/app/settings/audit", label: "审计日志", icon: ListChecks, permission: "audit:read", }, { href: "/app/settings/status", label: "运行状态", icon: Wrench, permission: "incident:read", }, ], }, ]; const navItems: NavItem[] = navGroups.flatMap((group) => group.items); type AppShellProps = { children: React.ReactNode; account: PublicAccount; permissions: Permission[]; }; export function AppShell({ children, account, permissions }: AppShellProps): React.ReactElement { const visibleNavGroups = navGroups .map((group) => ({ ...group, items: group.items.filter((item) => !item.permission || permissions.includes(item.permission)), })) .filter((group) => group.items.length > 0); return (

工作台

{account.name} {account.email}

{children}
); } export { navItems };