From 5ab99659bc1e184567762ca0d97fc3b6191a42bc Mon Sep 17 00:00:00 2001 From: sirpiglr <49359077-sirpiglr@users.noreply.replit.com> Date: Mon, 15 Dec 2025 23:31:22 +0000 Subject: [PATCH] Add an admin page to manage applications and resolve alerts Introduces a new admin page for managing applications and includes functionality to resolve alerts. Replit-Commit-Author: Agent Replit-Commit-Session-Id: 279f1558-c0e3-40e4-8217-be7e9f4c6eca Replit-Commit-Checkpoint-Type: intermediate_checkpoint Replit-Commit-Event-Id: 34bed664-a459-48b3-b4bd-fe1aeb4a6f47 Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/b984cb14-1d19-4944-922b-bc79e821ed35/279f1558-c0e3-40e4-8217-be7e9f4c6eca/GoEZTAy Replit-Helium-Checkpoint-Created: true --- client/src/App.tsx | 2 + client/src/pages/admin-aegis.tsx | 33 +- client/src/pages/admin-applications.tsx | 324 +++++++++++++++++ client/src/pages/admin.tsx | 3 +- client/src/pages/home.tsx | 451 ++++++++++++++++-------- client/src/pages/pitch.tsx | 238 ++++++++++++- server/routes.ts | 26 ++ server/storage.ts | 42 +++ 8 files changed, 961 insertions(+), 158 deletions(-) create mode 100644 client/src/pages/admin-applications.tsx diff --git a/client/src/App.tsx b/client/src/App.tsx index 7b7fe41..efd03ec 100644 --- a/client/src/App.tsx +++ b/client/src/App.tsx @@ -19,6 +19,7 @@ import AdminAegis from "@/pages/admin-aegis"; import AdminSites from "@/pages/admin-sites"; import AdminLogs from "@/pages/admin-logs"; import AdminAchievements from "@/pages/admin-achievements"; +import AdminApplications from "@/pages/admin-applications"; function Router() { return ( @@ -37,6 +38,7 @@ function Router() { + diff --git a/client/src/pages/admin-aegis.tsx b/client/src/pages/admin-aegis.tsx index 285ed04..709d3e5 100644 --- a/client/src/pages/admin-aegis.tsx +++ b/client/src/pages/admin-aegis.tsx @@ -1,15 +1,16 @@ import { useEffect } from "react"; import { Link, useLocation } from "wouter"; -import { useQuery } from "@tanstack/react-query"; +import { useQuery, useMutation, useQueryClient } from "@tanstack/react-query"; import { useAuth } from "@/lib/auth"; import { Users, FileCode, Shield, Activity, LogOut, - BarChart3, User, AlertTriangle, CheckCircle, XCircle, Eye, Globe, Award, Key + BarChart3, User, AlertTriangle, CheckCircle, XCircle, Globe, Award, Key, Inbox } from "lucide-react"; export default function AdminAegis() { const { user, isAuthenticated, isLoading: authLoading, logout } = useAuth(); const [, setLocation] = useLocation(); + const queryClient = useQueryClient(); useEffect(() => { if (!authLoading && !isAuthenticated) { @@ -37,6 +38,21 @@ export default function AdminAegis() { enabled: isAuthenticated, }); + const resolveAlertMutation = useMutation({ + mutationFn: async ({ id, is_resolved }: { id: string; is_resolved: boolean }) => { + const res = await fetch(`/api/alerts/${id}`, { + method: "PATCH", + headers: { "Content-Type": "application/json" }, + body: JSON.stringify({ is_resolved }), + }); + if (!res.ok) throw new Error("Failed to update alert"); + return res.json(); + }, + onSuccess: () => { + queryClient.invalidateQueries({ queryKey: ["alerts"] }); + }, + }); + if (authLoading || !isAuthenticated) { return (
@@ -130,6 +146,18 @@ export default function AdminAegis() { }`}> {alert.is_resolved ? 'resolved' : 'active'} +
))} @@ -179,6 +207,7 @@ function Sidebar({ user, onLogout, active }: { user: any; onLogout: () => void;