veza/apps/web/dist_verification/assets/AdminDashboardView-CvscVmHo.js

2 lines
16 KiB
JavaScript
Raw Normal View History

2026-02-07 19:36:48 +00:00
import{a as o,j as e}from"./vendor-react-YMhRUmcb.js";import{a as C,l as T,m as L,B as u,d as m,C as d}from"./index-D2uzyr9g.js";import{av as P,R as O,aE as U,aT as I,aN as _,aU as k,aV as M,x as z,aM as B,aJ as H,a as G,g as V,w as K,D as $,aW as Y,aw as F}from"./vendor-icons-DINCNwpk.js";import{T as Q,a as W,b as f,c as N}from"./Tabs-C8UCeQNW.js";import{G as A}from"./vendor-fFnFILYR.js";import"./skeleton-BPDNnZ8E.js";import"./vendor-router-DX94Iu-2.js";import"./vendor-tanstack-CoFNL2zy.js";import"./vendor-utils-4BWoYre8.js";const J=[{id:"r1",targetId:"u3",targetType:"user",targetName:"Bot_User_99",reason:"Spam",description:"Posting same link in 50 channels.",reportedBy:"Admin_Dave",status:"pending",timestamp:"2023-10-25 10:30 AM"},{id:"r2",targetId:"t105",targetType:"track",targetName:"Untitled Track",reason:"Copyright",description:"Direct rip of Skrillex track.",reportedBy:"Sarah Connor",status:"pending",timestamp:"2023-10-25 09:15 AM"},{id:"r3",targetId:"c88",targetType:"comment",targetName:"Comment #8821",reason:"Hate Speech",description:"Offensive language.",reportedBy:"Cyber_Producer",status:"reviewed",timestamp:"2023-10-24 04:20 PM"}],q=[{id:"u1",name:"Bass_Drop.wav",user:"Skrillex",size:"12MB",date:"5 mins ago"},{id:"u2",name:"Project_Alpha.zip",user:"Deadmau5",size:"450MB",date:"12 mins ago"},{id:"u3",name:"Cover_Art.png",user:"Grimes",size:"4MB",date:"20 mins ago"}],h={getDashboardStats:async()=>{try{const t=await C.get("/audit/stats");return!t.data||Object.keys(t.data).length===0?{totalUsers:12450,monthlyRevenue:45290,activeSessions:1840,pendingReports:14,trends:{users:5.2,revenue:12.8,sessions:-2.4,reports:0}}:{totalUsers:t.data.total_users||12450,monthlyRevenue:t.data.total_revenue||45290,activeSessions:t.data.active_sessions||1840,pendingReports:t.data.pending_reports||14,trends:t.data.trends||{users:0,revenue:0,sessions:0,reports:0}}}catch(t){return T.error("[Admin] Failed to fetch dashboard stats",{error:t}),{totalUsers:12450,monthlyRevenue:45290,activeSessions:1840,pendingReports:14,trends:{users:5.2,revenue:12.8,sessions:-2.4,reports:0}}}},getModerationQueue:async(t="pending")=>(await new Promise(a=>setTimeout(a,600)),J.filter(a=>t==="all"||a.status===t)),resolveReport:async(t,a)=>(await new Promise(r=>setTimeout(r,400)),{success:!0}),getRecentUploads:async()=>(await new Promise(t=>setTimeout(t,400)),q),getAuditLogs:async t=>(await C.get("/audit/logs",{params:t})).data};function X(){const{addToast:t}=L(),[a,r]=o.useState({}),[n,s]=o.useState([]),[x,g]=o.useState([]),[p,l]=o.useState([]),[j,y]=o.useState(!0),[R,w]=o.useState(null),S=o.useCallback(async()=>{y(!0);try{const[i,c,v,b]=await Promise.all([h.getDashboardStats(),h.getModerationQueue("pending"),h.getRecentUploads(),h.getAuditLogs({limit:10})]);r(i),s(c||[]),g(v||[]),l(b?.logs||[])}catch(i){T.error("Error loading admin dashboard",{error:i})}finally{y(!1)}},[]);o.useEffect(()=>{S()},[S]);const D=o.useCallback(async(i,c)=>{await h.resolveReport(i,c),s(v=>v.filter(b=>b.id!==i)),t(`Protocol "${c.toUpperCase()}" executed successfully.`,"success")},[t]),E=o.useCallback((i,c)=>{w(i),t(`INITIALIZING ${i.toUpperCase()}...`,"info"),setTimeout(()=>{t(`${i.toUpperCase()} DEPLOYED`,c),w(null)},2e3)},[t]);return{stats:a,reports:n,uploads:x,auditLogs:p,loading:j,protocolActive:R,handleAction:D,triggerProtocol:E}}function Z({protocolActive:t,onRescan:a,onLockdown:r}){return e.jsxs("div",{className:"flex flex-col md:flex-row items-start md:items-end justify-between gap-6",children:[e.jsxs("div",{children:[e.jsxs("h2",{className:"text-4xl font-display font-bold text-white mb-2 flex items-center gap-3",children:[e.jsx(P,{className:"text-primary w-10 h-10"})," COMMAND CENTER"]}),e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-2 h-2 rounded-full bg-lime-500 animate-pulse shadow-glow-lime"}),e.jsx("span",{className:"text-muted-foreground text-xs font-mono tracking-widest uppercase",children:"Nodes Online"})]}),e.jsx("div",{className:"h-3 w-px bg-white/10"}),e.jsx("span",