1import{j as e}from"./framer-motion-CbFncxLX.js";import{b as m}from"./tanstack-B0SOp_i7.js";import{H as j,h as u,i as f,j as p,ap as o,ce as g,l as h,S as d,f as c}from"./index-6z_mnp2h.js";import{a as x}from"./adminService-YJ5179mn.js";import{B as N}from"./building-2-CEeX-jyw.js";import{U as y}from"./users-DaG2nDL4.js";import{A as b}from"./activity-BVm0u0IB.js";import{f as v}from"./date-fns-Ds4Q3IhH.js";import"./radix-C_BAld3k.js";import"./recharts-C2xaRzo_.js";import"./supabase-CLaGB8z6.js";function F(){var n;const a=m({queryKey:["admin","overview"],queryFn:()=>x.overview(),refetchInterval:6e4}),r=m({queryKey:["admin","incidents","recent"],queryFn:()=>x.listIncidents({limit:12}),refetchInterval:6e4}),s=a.data,i=((n=r.data)==null?void 0:n.incidents)??[];return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-xl md:text-2xl font-semibold",children:"Platform overview"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Cross-tenant view of every customer running on sureops."})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4 @3xl:grid-cols-4",children:[e.jsx(l,{icon:e.jsx(N,{className:"h-4 w-4 text-primary"}),label:"Tenants",value:s==null?void 0:s.orgCount,loading:a.isLoading}),e.jsx(l,{icon:e.jsx(y,{className:"h-4 w-4 text-primary"}),label:"Total members",value:s==null?void 0:s.userCount,loading:a.isLoading}),e.jsx(l,{icon:e.jsx(j,{className:"h-4 w-4 text-amber-500"}),label:"Open incidents",value:s==null?void 0:s.openIncidentCount,loading:a.isLoading}),e.jsx(l,{icon:e.jsx(b,{className:"h-4 w-4 text-emerald-500"}),label:"Last 24h",value:s==null?void 0:s.incidentsLast24h,subValue:s?`${s.incidentsLast7d} / 7d · ${s.incidentsLast30d} / 30d`:void 0,loading:a.isLoading})]}),e.jsxs(u,{children:[e.jsxs(f,{className:"flex flex-row items-center justify-between",children:[e.jsx(p,{className:"text-base font-medium",children:"Recent incidents"}),e.jsxs(o,{to:"/admin/incidents",className:"flex items-center gap-1 text-xs text-primary hover:underline",children:["View all ",e.jsx(g,{className:"h-3 w-3"})]})]}),e.jsxs(h,{className:"space-y-2",children:[r.isLoading&&e.jsxs(e.Fragment,{children:[e.jsx(d,{className:"h-12 w-full"}),e.jsx(d,{className:"h-12 w-full"}),e.jsx(d,{className:"h-12 w-full"})]}),!r.isLoading&&i.length===0&&e.jsx("p",{className:"py-6 text-center text-sm text-muted-foreground",children:"No incidents recorded yet."}),i.map(t=>e.jsxs(o,{to:`/admin/incidents/${t.id}/analytics`,className:"flex items-center justify-between rounded-md border border-border/40 px-3 py-2.5 text-sm hover:bg-muted",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:"truncate font-medium",children:t.title}),e.jsxs("p",{className:"truncate text-xs text-muted-foreground",children:[t.organizationName??t.organizationId.slice(0,8)," ·"," ",v(new Date(t.createdAt),{addSuffix:!0})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[t.severity&&e.jsx(c,{variant:"outline",className:"text-[10px] uppercase",children:t.severity}),t.status&&e.jsx(c,{variant:"outline",className:["resolved","closed"].includes(t.status.toLowerCase())?"border-emerald-500/40 text-emerald-500":"border-amber-500/40 text-amber-500",children:t.status})]})]},t.id))]})]})]})}function l({icon:a,label:r,value:s,subValue:i,loading:n}){return e.jsx(u,{children:e.jsxs(h,{className:"p-4",children:[e.jsxs("div",{className:"flex items-center gap-2 text-xs uppercase tracking-wider text-muted-foreground",children:[a,r]}),n?e.jsx(d,{className:"mt-2 h-8 w-16"}):e.jsx("div",{className:"mt-1 text-2xl font-semibold",children:s??"â"}),i&&e.jsx("div",{className:"mt-1 text-xs text-muted-foreground",children:i})]})})}export{F as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.