import { useState } from 'react'; import { Header } from '@/components/Header'; import { Footer } from '@/components/Footer'; import { Button } from '@/components/ui/button'; import { Shield, Users, BarChart3, FileText, ArrowLeft } from 'lucide-react'; import { AdminDashboard } from '@/components/admin/AdminDashboard'; import AnalyticsDashboard from '@/components/admin/AnalyticsDashboard'; import ScriptReviewDashboard from '@/components/admin/ScriptReviewDashboard'; import { CreateAdminForm } from '@/components/admin/CreateAdminForm'; import { AdminUsersList } from '@/components/admin/AdminUsersList'; import { useAuth } from '@/contexts/AuthContext'; type AdminView = 'dashboard' | 'create-user' | 'users' | 'scripts' | 'analytics'; export default function AdminPanel() { const { user } = useAuth(); const [currentView, setCurrentView] = useState('dashboard'); // Check if user has admin access if (!user?.isAdmin) { return (
{}} />

Access Denied

You don't have permission to access the admin panel.

); } const renderView = () => { switch (currentView) { case 'dashboard': return ( setCurrentView('create-user')} onViewScripts={() => setCurrentView('scripts')} onViewAnalytics={() => setCurrentView('analytics')} /> ); case 'create-user': return (
setCurrentView('users')} />
); case 'users': return (
); case 'scripts': return setCurrentView('dashboard')} />; case 'analytics': return setCurrentView('dashboard')} />; default: return null; } }; return (
{}} />

Admin Panel

Manage the platform and moderate content.

{user.isSuperUser && (
Super User Access
)}
{renderView()}
); }