'use client'; import { useAuth } from '@/lib/auth-context'; import { useRouter } from 'next/navigation'; import { useEffect } from 'react'; export default function ProtectedRoute({ 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 (