import { prisma } from '@/lib/prisma' import { requireRole } from '@/lib/auth-redirect' import { AdminSidebar } from '@/components/layouts/admin-sidebar' import { AdminEditionWrapper } from '@/components/layouts/admin-edition-wrapper' import { RoleSwitcherPill } from '@/components/layouts/role-switcher' export default async function AdminLayout({ children, }: { children: React.ReactNode }) { const session = await requireRole('SUPER_ADMIN', 'PROGRAM_ADMIN') // Fetch all editions (programs) for the edition selector const editions = await prisma.program.findMany({ select: { id: true, name: true, year: true, status: true, }, orderBy: { year: 'desc' }, }) return (
{/* Spacer for mobile header */}
{/* Top-bar — hosts the RoleSwitcherPill so multi-role admins can switch dashboards from the same screen position used on every other layout. Pill auto-hides for single-role users. */}
{children}
) }