import { motion } from "framer-motion"; import { Link, useLocation } from "wouter"; import { useQuery } from "@tanstack/react-query"; import { useAuth } from "@/lib/auth"; import { Users, FileCode, Shield, Activity, LogOut, BarChart3, User, Globe, Key, CheckCircle, XCircle, AlertTriangle } from "lucide-react"; export default function AdminLogs() { const { user, logout } = useAuth(); const [, setLocation] = useLocation(); const { data: logs, isLoading } = useQuery({ queryKey: ["auth-logs"], queryFn: async () => { const res = await fetch("/api/auth-logs"); if (!res.ok) throw new Error("Failed to fetch logs"); return res.json(); }, }); const handleLogout = async () => { await logout(); setLocation("/"); }; const getEventIcon = (eventType: string) => { if (eventType?.includes('success') || eventType?.includes('login')) { return ; } else if (eventType?.includes('fail') || eventType?.includes('error')) { return ; } else if (eventType?.includes('warn')) { return ; } return ; }; return (

Auth Logs

{logs?.length || 0} recent authentication events

{isLoading ? ( ) : logs?.length === 0 ? ( ) : ( logs?.map((log: any) => ( )) )}
Event User IP Address User Agent Time
Loading...

No Auth Logs Yet

Authentication events will appear here as users log in and out. The auth_logs table in Supabase is currently empty.

{getEventIcon(log.event_type)} {log.event_type}
{log.user_id?.substring(0, 8)}... {log.ip_address || 'N/A'} {log.user_agent || 'N/A'} {log.created_at ? new Date(log.created_at).toLocaleString() : 'N/A'}
); } function Sidebar({ user, onLogout, active }: { user: any; onLogout: () => void; active: string }) { return (

AeThex

Command Center

{user?.username}
{user?.isAdmin ? "Administrator" : "Member"}
); } function NavItem({ icon, label, href, active = false }: { icon: React.ReactNode; label: string; href: string; active?: boolean }) { return (
{icon} {label}
); }