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 + Sidebar).
 * - 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>
	);
}
