'use client'; import { useEffect } from 'react'; import { useRouter } from 'next/navigation'; import { useOrgAdmin } from '../_lib/org-admin-context'; import { PortalNav } from '../_components/portal-nav'; import { LayoutDashboard, Building2, Shield } from 'lucide-react'; const NAV = [ { href: '/org', label: 'Dashboard', icon: }, { href: '/org/tenants', label: 'Chapters', icon: }, { href: '/org/rules', label: 'Org Rules', icon: }, ]; export default function OrgLayout({ children }: { children: React.ReactNode }) { const { orgAdmin, loading, logout } = useOrgAdmin(); const router = useRouter(); useEffect(() => { if (!loading && !orgAdmin) router.replace('/org/login'); }, [orgAdmin, loading, router]); if (loading) { return (
); } if (!orgAdmin) return null; return (
{ void logout(); router.replace('/org/login'); }} />
{children}
); }