import Image from 'next/image'; import Link from 'next/link'; import { auth, signOut } from '@/lib/auth'; /** Extended as each page lands, so nothing in the bar leads nowhere. */ const NAV = [ { href: '/admin', label: 'Tableau de bord' }, { href: '/admin/horaires', label: 'Horaires' }, ]; /** * The admin shell. * * The middleware has already established that there is a session by the time * this renders; the call here is only to know who it is. Navigation links are * added as their pages land, so nothing in the bar leads nowhere. */ export default async function AdminLayout({ children }: { children: React.ReactNode }) { const session = await auth(); const email = session?.user?.email ?? ''; const isAdmin = session?.user?.role === 'admin'; return (
ITA ITO
{!isAdmin ? ( Lecture seule ) : null} {email}
{ 'use server'; await signOut({ redirectTo: '/login' }); }} >
{children}
); }