From fc2dee988df09febaff5130fdaf7699908a5b873 Mon Sep 17 00:00:00 2001 From: "Builder.io" Date: Tue, 11 Nov 2025 17:18:35 +0000 Subject: [PATCH] Create Staff Dashboard with operations tabs cgen-63613eb011944e5bbbfe76eaf2fb6119 --- client/pages/StaffDashboard.tsx | 300 ++++++++++++++++++++++++++++++++ 1 file changed, 300 insertions(+) create mode 100644 client/pages/StaffDashboard.tsx diff --git a/client/pages/StaffDashboard.tsx b/client/pages/StaffDashboard.tsx new file mode 100644 index 00000000..eb95ffa8 --- /dev/null +++ b/client/pages/StaffDashboard.tsx @@ -0,0 +1,300 @@ +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 */} +
+ + + +
+
+
+
+ ); +}