"use client" import type React from "react" import { useEffect } from "react" import { useRouter } from "next/navigation" import { useAuth } from "@/lib/auth-context" import { AdminSidebar } from "./admin-sidebar" import { Loader2 } from "lucide-react" export function AdminShell({ children }: { children: React.ReactNode }) { const { isAuthenticated, isLoading } = useAuth() const router = useRouter() useEffect(() => { if (!isLoading && !isAuthenticated) { router.push("/admin/login") } }, [isAuthenticated, isLoading, router]) if (isLoading) { return (
) } if (!isAuthenticated) { return null } return (
{children}
) }