diff --git a/client/pages/Admin.tsx b/client/pages/Admin.tsx new file mode 100644 index 00000000..482e8984 --- /dev/null +++ b/client/pages/Admin.tsx @@ -0,0 +1,165 @@ +import Layout from "@/components/Layout"; +import LoadingScreen from "@/components/LoadingScreen"; +import { useAuth } from "@/contexts/AuthContext"; +import { useEffect } from "react"; +import { useNavigate } from "react-router-dom"; +import { Card, CardContent, CardHeader, CardTitle, CardDescription } from "@/components/ui/card"; +import { Badge } from "@/components/ui/badge"; +import { Button } from "@/components/ui/button"; +import { Shield, UserCog, Rocket, Settings, Users, Activity } from "lucide-react"; + +export default function Admin() { + const { user, loading } = useAuth(); + const navigate = useNavigate(); + const isOwner = !!user?.email && user.email.toLowerCase() === "mrpiglr@gmail.com"; + + useEffect(() => { + if (!loading) { + if (!user) { + navigate("/login", { replace: true }); + } + } + }, [user, loading, navigate]); + + if (loading || !user) { + return ( + + ); + } + + if (!isOwner) { + return ( + + + + + + Access Denied + You dont have permission to access the admin panel. + + + navigate("/dashboard")}>Go to Dashboard + + + + + + ); + } + + return ( + + + + + + Admin Panel + Site Owner • Admin • Founder + + Site Owner + Admin + Founder + + + + navigate("/dashboard")}>Dashboard + navigate("/profile")}>Profile + + + + + + + + + Access Control + + Owner-only access is enforced by email + + + + + Owner: mrpiglr@gmail.com + + All other users are denied access + + + + + + + + + Users & Roles + + Future: manage roles, invitations, and status + + + Coming soon + + + + + + + + Site Settings + + Branding, legal, integrations + + + navigate("/get-started")}>Open Settings + + + + + + + + System Status + + Auth, database, and services + + + + Auth: Operational + Database: Operational (mock fallback available) + Realtime: Operational + + + + + + + + + Quick Actions + + Common admin operations + + + navigate("/dashboard")}>View Dashboard + navigate("/onboarding")}>Run Onboarding + + + + + + + + Your Account + + Signed in as {user.email} + + + + You have full administrative access. + + + + + + + + ); +}
Site Owner • Admin • Founder
Coming soon