import { useState, useEffect } from "react"; import { useNavigate } from "react-router-dom"; import Layout from "@/components/Layout"; import { Button } from "@/components/ui/button"; import { Card, CardContent, CardHeader, CardTitle, CardDescription, } from "@/components/ui/card"; import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs"; import { Badge } from "@/components/ui/badge"; import { Alert, AlertDescription } from "@/components/ui/alert"; import { useAuth } from "@/contexts/AuthContext"; import { useAethexToast } from "@/hooks/use-aethex-toast"; import LoadingScreen from "@/components/LoadingScreen"; import { BarChart3, Users, AlertTriangle, Heart, LogOut, Home, Shield, Clock, } from "lucide-react"; export default function StaffDashboard() { const navigate = useNavigate(); const { user, profile, loading, signOut } = useAuth(); const { info: toastInfo } = useAethexToast(); const [isLoading, setIsLoading] = useState(true); const [activeTab, setActiveTab] = useState("overview"); useEffect(() => { // Check if user is @aethex.dev if (!loading && user) { const email = user.email || profile?.email || ""; if (!email.endsWith("@aethex.dev")) { navigate("/staff/login", { replace: true }); return; } setIsLoading(false); } }, [user, profile, loading, navigate]); const handleSignOut = async () => { await signOut(); toastInfo({ title: "Signed out", description: "You have been signed out of the staff portal.", }); navigate("/staff/login", { replace: true }); }; if (loading || isLoading) { return ( ); } return (
{/* Header */}

Staff Dashboard

Welcome, {profile?.full_name || user?.email}

{/* Quick Stats */}

Active Users

2.4K

System Status

Healthy

Pending Reviews

8

Health Score

94%

{/* Main Content Tabs */} Operations Overview Moderation Mentorship Users {/* Overview Tab */}

System Overview

API Response Time 95ms
Database Health 100%
Cache Hit Rate 87%
Error Rate 0.2%
{/* Moderation Tab */} 8 user reports pending review

Moderation tools and user reports will appear here

{/* Mentorship Tab */}

Active Mentorships

24

Pending Requests

6

{/* Users Tab */}
Total Users 2,487
Active This Week 1,234
New This Month 287
{/* Navigation Shortcuts */}
); }