From 53f2a43181910287dadd0079bb1f1e738f1c6dff Mon Sep 17 00:00:00 2001 From: "Builder.io" Date: Sat, 27 Sep 2025 21:05:42 +0000 Subject: [PATCH] Add Admin page with access control for owner email cgen-023d7e5b8be94c318cf20d26d11af67c --- client/pages/Admin.tsx | 165 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 165 insertions(+) create mode 100644 client/pages/Admin.tsx 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. + + + + + +
+
+
+ ); + } + + return ( + +
+
+
+
+

Admin Panel

+

Site Owner • Admin • Founder

+
+ Site Owner + Admin + Founder +
+
+
+ + +
+
+ +
+ + +
+ + 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 +
+ + + +
+ + + +
+ + System Status +
+ Auth, database, and services +
+ +
    +
  • Auth: Operational
  • +
  • Database: Operational (mock fallback available)
  • +
  • Realtime: Operational
  • +
+
+
+ + + +
+ + Quick Actions +
+ Common admin operations +
+ + + + +
+ + + +
+ + Your Account +
+ Signed in as {user.email} +
+ +
+ You have full administrative access. +
+
+
+
+
+
+
+ ); +}