'use client'; import { useEffect } from 'react'; import { useRouter } from 'next/navigation'; import { useSuperAdmin } from '@/app/_lib/super-admin-context'; import { PortalShell } from '@/app/_components/portal-shell'; import { LayoutDashboard, Building2, Network, Server, FileText } from 'lucide-react'; const NAV = [ { href: '/admin', label: 'Dashboard', icon: }, { href: '/admin/orgs', label: 'Organisations', icon: }, { href: '/admin/tenants', label: 'Chapters', icon: }, { href: '/admin/bots', label: 'Bot Pool', icon: }, { href: '/admin/drafts', label: 'AI Drafts', icon: }, ]; export default function AdminAuthedLayout({ children }: { children: React.ReactNode }) { const { admin, loading, logout } = useSuperAdmin(); const router = useRouter(); useEffect(() => { if (!loading && !admin) router.replace('/admin/login'); }, [admin, loading, router]); return ( { void logout(); router.replace('/admin/login'); }} > {children} ); }