import AppShell from "@/components/app-shell/AppShell";
import AuthProvider from "@/components/auth/AuthProvider";
import AuthGate from "@/components/auth/AuthGate";

/**
 * Protected layout
 *
 * UX goal:
 * - Keep the AppShell visible at all times (TopNav + main content frame).
 * - Render auth/loading/error states inside the main content area via AuthGate.
 *
 * This avoids "blank spinner" screens on slow connections.
 */
export default function ProtectedLayout({ children }) {
	return (
		<AuthProvider>
			<AppShell>
				<AuthGate>{children}</AuthGate>
			</AppShell>
		</AuthProvider>
	);
}
