diff --git a/client/pages/Staff.tsx b/client/pages/Staff.tsx new file mode 100644 index 00000000..828ab7a5 --- /dev/null +++ b/client/pages/Staff.tsx @@ -0,0 +1,153 @@ +import React, { useEffect, useMemo, useState } from "react"; +import Layout from "@/components/Layout"; +import { useAuth } from "@/contexts/AuthContext"; +import { useNavigate } from "react-router-dom"; +import { aethexToast } from "@/lib/aethex-toast"; +import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs"; +import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card"; +import { Badge } from "@/components/ui/badge"; +import { Button } from "@/components/ui/button"; +import { Separator } from "@/components/ui/separator"; + +function useHasStaffAccess(roles: string[]) { + return useMemo( + () => + roles.some((r) => + ["owner", "admin", "founder", "staff", "employee"].includes( + r.toLowerCase(), + ), + ), + [roles], + ); +} + +export default function Staff() { + const { user, roles, loading } = useAuth(); + const navigate = useNavigate(); + const hasAccess = useHasStaffAccess(roles); + + useEffect(() => { + if (loading) return; + if (!user) { + aethexToast.info({ title: "Sign in required", description: "Staff area requires authentication" }); + navigate("/login"); + return; + } + if (!hasAccess) { + aethexToast.error({ title: "Access denied", description: "You don't have staff permissions" }); + navigate("/dashboard"); + } + }, [user, roles, hasAccess, loading, navigate]); + + const [activeTab, setActiveTab] = useState("overview"); + + return ( + +
+
+ Internal +

Operations Command

+

Staff dashboards, moderation, and internal tools.

+
+ + + + Overview + Moderation + Mentorship + Users + + + +
+ + + Community Health + Quick pulse across posts and reports + + +
+
Open reports
+
0
+
+
+
Mentorship requests
+
0
+
+
+
+ + + Service Status + APIs and queues + + +
+
Admin API
+ OK +
+
+
Notifications
+ OK +
+
+
+ + + Shortcuts + Common operational links + + + + + + + +
+
+ + + + + Moderation Queue + Flagged content and actions + + +

No items in queue.

+
+
+
+ + + + + Mentorship Requests + Review recent mentor/mentee activity + + +

No requests to review.

+ + +
+
+
+ + + + + Users + Search, roles, and quick actions + + +

User tools coming soon.

+
+
+
+
+
+
+ ); +}