'use client'; import { useEffect } from 'react'; import { useRouter } from 'next/navigation'; import { useOrgAdmin } from '@/app/_lib/org-admin-context'; import { PortalShell } from '@/app/_components/portal-shell'; 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 OrgAuthedLayout({ children }: { children: React.ReactNode }) { const { orgAdmin, loading, logout } = useOrgAdmin(); const router = useRouter(); useEffect(() => { if (!loading && !orgAdmin) router.replace('/org/login'); }, [orgAdmin, loading, router]); return ( { void logout(); router.replace('/org/login'); }} > {children} ); }