1import{c as x,r as i,U as W,V as S,w as _,M as o,N as l,j as e,x as a}from"./index-DpKu2G-K.js";import{s as c}from"./startOfDay-DB61a6dQ.js";import{s as d}from"./subDays-D8SFi5JK.js";/** 2 * @license lucide-react v0.462.0 - ISC 3 * 4 * This source code is licensed under the ISC license. 5 * See the LICENSE file in the root directory of this source tree. 6 */const m=x("CalendarCheck",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"m9 16 2 2 4-4",key:"19s6y9"}]]);/** 7 * @license lucide-react v0.462.0 - ISC 8 * 9 * This source code is licensed under the ISC license. 10 * See the LICENSE file in the root directory of this source tree. 11 */const h=x("TrendingUp",[["polyline",{points:"22 7 13.5 15.5 8.5 10.5 2 17",key:"126l90"}],["polyline",{points:"16 7 22 7 22 13",key:"kwv8wd"}]]),$=()=>{const[t,u]=i.useState({users:0,trainings:0,pins:0,members:0,newUsersThisWeek:0,newMembersThisWeek:0,rsvpsThisWeek:0,newUsersThisMonth:0,newMembersThisMonth:0,rsvpsThisMonth:0});i.useEffect(()=>{(async()=>{const n=c(d(new Date,7)).toISOString(),r=c(d(new Date,30)).toISOString(),[f,v,w,y,j,M,N,k,T,U]=await Promise.all([a.from("profiles").select("id",{count:"exact",head:!0}),a.from("trainings_safe").select("id",{count:"exact",head:!0}),a.from("map_pins").select("id",{count:"exact",head:!0}),a.from("members").select("id",{count:"exact",head:!0}),a.from("profiles").select("id",{count:"exact",head:!0}).gte("created_at",n),a.from("members").select("id",{count:"exact",head:!0}).gte("created_at",n),a.from("training_rsvps").select("id",{count:"exact",head:!0}).gte("rsvpd_at",n),a.from("profiles").select("id",{count:"exact",head:!0}).gte("created_at",r),a.from("members").select("id",{count:"exact",head:!0}).gte("created_at",r),a.from("training_rsvps").select("id",{count:"exact",head:!0}).gte("rsvpd_at",r)]);u({users:f.count||0,trainings:v.count||0,pins:w.count||0,members:y.count||0,newUsersThisWeek:j.count||0,newMembersThisWeek:M.count||0,rsvpsThisWeek:N.count||0,newUsersThisMonth:k.count||0,newMembersThisMonth:T.count||0,rsvpsThisMonth:U.count||0})})()},[]);const p=[{label:"Total Users",value:t.users,icon:W,color:"text-primary"},{label:"Trainings",value:t.trainings,icon:S,color:"text-secondary"},{label:"Map Pins",value:t.pins,icon:_,color:"text-primary"},{label:"Members",value:t.members,icon:o,color:"text-secondary"}],b=[{label:"New Users",value:t.newUsersThisWeek,icon:l,color:"text-primary"},{label:"New Members",value:t.newMembersThisWeek,icon:o,color:"text-secondary"},{label:"Training RSVPs",value:t.rsvpsThisWeek,icon:m,color:"text-primary"}],g=[{label:"New Users",value:t.newUsersThisMonth,icon:l,color:"text-primary"},{label:"New Members",value:t.newMembersThisMonth,icon:o,color:"text-secondary"},{label:"Training RSVPs",value:t.rsvpsThisMonth,icon:m,color:"text-primary"}];return e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-heading font-bold mb-6",children:"Admin Dashboard"}),e.jsx("div",{className:"grid sm:grid-cols-2 lg:grid-cols-4 gap-4 mb-8",children:p.map(s=>e.jsxs("div",{className:"bg-background rounded-lg p-6 border shadow-sm",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("span",{className:"text-sm text-muted-foreground font-heading",children:s.label}),e.jsx(s.icon,{className:`w-5 h-5 ${s.color}`})]}),e.jsx("div",{className:"text-3xl font-heading font-bold",children:s.value})]},s.label))}),e.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[e.jsx(h,{className:"w-4 h-4 text-primary"}),e.jsx("h2",{className:"text-lg font-heading font-semibold",children:"Last 7 Days"})]}),e.jsx("div",{className:"grid sm:grid-cols-3 gap-4 mb-8",children:b.map(s=>e.jsxs("div",{className:"bg-background rounded-lg p-5 border shadow-sm",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("span",{className:"text-sm text-muted-foreground font-heading",children:s.label}),e.jsx(s.icon,{className:`w-5 h-5 ${s.color}`})]}),e.jsx("div",{className:"text-2xl font-heading font-bold",children:s.value})]},`week-${s.label}`))}),e.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[e.jsx(h,{className:"w-4 h-4 text-secondary"}),e.jsx("h2",{className:"text-lg font-heading font-semibold",children:"Last 30 Days"})]}),e.jsx("div",{className:"grid sm:grid-cols-3 gap-4",children:g.map(s=>e.jsxs("div",{className:"bg-background rounded-lg p-5 border shadow-sm",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("span",{className:"text-sm text-muted-foreground font-heading",children:s.label}),e.jsx(s.icon,{className:`w-5 h-5 ${s.color}`})]}),e.jsx("div",{className:"text-2xl font-heading font-bold",children:s.value})]},`month-${s.label}`))})]})};export{$ 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.