"use client" import type {ReactNode} from "react" import {Loader2} from "lucide-react" import {ErrorPage} from "@/components/layout/error" import {useUser} from "@/contexts/user-context" type RequireAuthProps = { children: ReactNode fallback?: ReactNode minHeightClassName?: string } /** * Guards page content until the session user is available. * Redirect to login is handled by the parent layout; this only covers the content slot. */ export function RequireAuth({ children, fallback, minHeightClassName = "min-h-[400px]", }: RequireAuthProps) { const {user, loading} = useUser() if (loading) { return fallback ?? (