diff --git a/client/pages/Staff.tsx b/client/pages/Staff.tsx index 3266f870..9e830147 100644 --- a/client/pages/Staff.tsx +++ b/client/pages/Staff.tsx @@ -1,371 +1,240 @@ -import React, { useEffect, useMemo, useState } from "react"; -import Layout from "@/components/Layout"; -import { useAuth } from "@/contexts/AuthContext"; +import { useEffect } from "react"; 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 Layout from "@/components/Layout"; +import SEO from "@/components/SEO"; +import { useAuth } from "@/contexts/AuthContext"; 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], - ); -} +import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card"; +import { Badge } from "@/components/ui/badge"; +import { Lock, Users, FileText, Zap, Award, MessageSquare } from "lucide-react"; export default function Staff() { - const { user, roles, loading } = useAuth(); + const { user, 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("/onboarding"); - return; + if (!loading && user) { + navigate("/staff/dashboard", { replace: true }); } - 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"); - const [openReports, setOpenReports] = useState([]); - const [mentorshipAll, setMentorshipAll] = useState([]); - const [loadingData, setLoadingData] = useState(false); - const [searchQ, setSearchQ] = useState(""); - const [users, setUsers] = useState([]); - - const refresh = async () => { - setLoadingData(true); - try { - const [r1, r2] = await Promise.all([ - fetch("/api/moderation/reports?status=open&limit=100"), - fetch("/api/mentorship/requests/all?limit=50&status=pending"), - ]); - const reports = r1.ok ? await r1.json() : []; - const m = r2.ok ? await r2.json() : []; - setOpenReports(Array.isArray(reports) ? reports : []); - setMentorshipAll(Array.isArray(m) ? m : []); - } catch (e) { - /* ignore */ - } finally { - setLoadingData(false); - } - }; - - useEffect(() => { - if (user && hasAccess) refresh(); - }, [user, hasAccess]); - - const loadUsers = async () => { - try { - const params = new URLSearchParams(); - if (searchQ.trim()) params.set("q", searchQ.trim()); - params.set("limit", "25"); - const resp = await fetch(`/api/staff/users?${params.toString()}`); - const data = resp.ok ? await resp.json() : []; - setUsers(Array.isArray(data) ? data : []); - } catch { - setUsers([]); - } - }; - - const updateReportStatus = async ( - id: string, - status: "resolved" | "ignored" | "open", - ) => { - try { - const resp = await fetch( - `/api/moderation/reports/${encodeURIComponent(id)}/status`, - { - method: "POST", - headers: { "Content-Type": "application/json" }, - body: JSON.stringify({ status }), - }, - ); - if (resp.ok) { - aethexToast.success({ - title: "Updated", - description: `Report marked ${status}`, - }); - refresh(); - } - } catch {} - }; + }, [user, loading, navigate]); return ( -
-
- - Internal - -

Operations Command

-

- Staff dashboards, moderation, and internal tools. -

+ + +
+ {/* Animated background */} +
+
+
+
- - - Overview - Moderation - Mentorship - Users - +
+ {/* Hero Section */} +
+ + Internal Platform + - -
- +

+ AeThex Staff +

+ +

+ The internal hub for AeThex employees and authorized contractors. + Unified access to dashboards, tools, documentation, and collaboration features. +

+ +
+ + +
+
+ + {/* Features Grid */} +
+

+ Staff Tools & Features +

+ +
+ {/* Dashboard */} + - Community Health - - Quick pulse across posts and reports +
+
+ +
+ Dashboard +
+
+ + + Real-time operations metrics, service status, and quick access to common tools. - - -
-
- Open reports -
-
- {openReports.length} -
-
-
-
- Mentorship requests -
-
- {mentorshipAll.length} -
-
- + + {/* Directory */} + - Service Status - APIs and queues +
+
+ +
+ Directory +
-
-
- Admin API -
- OK -
-
-
- Notifications -
- OK -
+ + Browse team members, view profiles, and find contact information. +
- + + {/* Admin Tools */} + - Shortcuts - Common operational links +
+
+ +
+ Admin Tools +
- - - - + + + Manage users, roles, permissions, and platform configuration. + + +
+ + {/* Docs */} + + +
+
+ +
+ Docs & API +
+
+ + + Internal documentation, API keys, credentials, and setup guides. + + +
+ + {/* Achievements */} + + +
+
+ +
+ Achievements +
+
+ + + Track team accomplishments, milestones, and performance metrics. + + +
+ + {/* Collaboration */} + + +
+
+ +
+ Collaboration +
+
+ + + Internal chat, team discussions, and project coordination. +
- +
- - - - Moderation Queue - Flagged content and actions - - - {loadingData && ( -

Loading…

- )} - {!loadingData && openReports.length === 0 && ( -

- No items in queue. -

- )} -
- {openReports.map((r) => ( -
-
-
-
{r.reason}
-
- {r.details} -
-
-
- - -
-
-
- ))} -
-
-
-
+ {/* Info Section */} +
+
+
+

Who Can Access?

+
    +
  • + + AeThex employees (@aethex.dev) +
  • +
  • + + Authorized contractors (invited) +
  • +
  • + + Partners with special access +
  • +
+
- - - - Mentorship Requests - - Review recent mentor/mentee activity - - - - {loadingData && ( -

Loading…

- )} - {!loadingData && mentorshipAll.length === 0 && ( -

- No requests to review. -

- )} -
- {mentorshipAll.map((req) => ( -
-
-
-
- {req.mentee?.full_name || req.mentee?.username} →{" "} - {req.mentor?.full_name || req.mentor?.username} -
-
- {req.message || "No message"} -
-
-
- - {req.status} - -
-
-
- ))} -
- - -
-
-
+
+

Getting Started

+
    +
  1. + 1. + Click "Staff Login" to sign in with Google +
  2. +
  3. + 2. + Use your @aethex.dev email address +
  4. +
  5. + 3. + Access your personalized dashboard +
  6. +
+
+
+
- - - - Users - - Search, roles, and quick actions - - - -
- setSearchQ(e.target.value)} - /> - -
-
- {users.length === 0 ? ( -

- No users found. -

- ) : ( -
- {users.map((u) => ( -
-
-
- {u.full_name || u.username || u.id} -
-
- {u.username} -
-
- - {u.user_type || "unknown"} - -
- ))} -
- )} -
-
-
-
- + {/* Footer CTA */} +
+

+ Not a staff member? Visit the public platform. +

+ +
+
);