1import{j as e,i as w,m as k,h as v,bk as p,o as M,a5 as F,bq as y,n as P,aK as T,C as d,b as c,c as x,d as o,aO as b}from"./index-Byg2HWAE.js";import{M as H,m as B}from"./memberService-CISoEFwf.js";import"./vendor-Qgthw7N1.js";import{C}from"./calendar-days-CZv4Giu2.js";function l(r){return`${(r??0).toFixed(1)}h`}function g({label:r,value:t,helper:a,icon:n}){return e.jsxs("div",{className:"rounded-2xl border border-gray-100 bg-white p-4 shadow-sm dark:border-gray-800 dark:bg-gray-800",children:[e.jsx("div",{className:"mb-3 flex h-10 w-10 items-center justify-center rounded-xl bg-green-50 text-green-700 dark:bg-green-950/40 dark:text-green-300",children:n}),e.jsx("p",{className:"text-xs font-semibold uppercase tracking-wide text-gray-500 dark:text-gray-400",children:r}),e.jsx("p",{className:"mt-1 text-2xl font-bold tracking-tight text-gray-900 dark:text-white",children:t}),e.jsx("p",{className:"mt-1 text-xs text-gray-500 dark:text-gray-400",children:a})]})}function E(){return e.jsxs("div",{className:"space-y-4",children:[e.jsx(H,{title:"My Statistics",subtitle:"Personal analytics"}),e.jsx("div",{className:"grid grid-cols-2 gap-3",children:[1,2,3,4].map(r=>e.jsxs("div",{className:"rounded-2xl border border-gray-100 bg-white p-4 shadow-sm dark:border-gray-800 dark:bg-gray-800",children:[e.jsx(y,{className:"h-10 w-10 rounded-xl"}),e.jsx(y,{className:"mt-4 h-3 w-20 rounded"}),e.jsx(y,{className:"mt-2 h-7 w-16 rounded"})]},r))})]})}function A({stats:r,isLoading:t}){if(t)return e.jsx(E,{});const a=(r==null?void 0:r.totalHours)??0,n=(r==null?void 0:r.materialParticipationHours)??0,m=a?n/a*100:0,h=(r==null?void 0:r.activityBreakdown)??[],u=(r==null?void 0:r.recentEntries)??[];return e.jsxs(e.Fragment,{children:[e.jsx(H,{title:"My Statistics",subtitle:"Personal analytics"}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsx(g,{label:"Total Hours",value:l(r==null?void 0:r.totalHours),helper:"All time",icon:e.jsx(w,{className:"h-5 w-5"})}),e.jsx(g,{label:"This Week",value:l(r==null?void 0:r.thisWeekHours),helper:"Current week",icon:e.jsx(k,{className:"h-5 w-5"})}),e.jsx(g,{label:"This Month",value:l(r==null?void 0:r.thisMonthHours),helper:"Current month",icon:e.jsx(C,{className:"h-5 w-5"})}),e.jsx(g,{label:"Material",value:l(r==null?void 0:r.materialParticipationHours),helper:`${m.toFixed(0)}% of total`,icon:e.jsx(v,{className:"h-5 w-5"})})]}),e.jsxs("section",{className:"rounded-2xl border border-gray-100 bg-white p-4 shadow-sm dark:border-gray-800 dark:bg-gray-800",children:[e.jsxs("div",{className:"mb-4 flex items-center justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-base font-bold text-gray-900 dark:text-white",children:"Material Participation"}),e.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:"REPS activity mix"})]}),e.jsxs("span",{className:"rounded-full bg-green-50 px-3 py-1 text-xs font-semibold text-green-700 dark:bg-green-950/40 dark:text-green-300",children:[m.toFixed(0),"%"]})]}),e.jsx(p,{value:m,className:"h-2"}),e.jsxs("p",{className:"mt-3 text-xs text-gray-500 dark:text-gray-400",children:[l(n)," material out of ",l(a)," total."]})]}),e.jsxs("section",{className:"rounded-2xl border border-gray-100 bg-white p-4 shadow-sm dark:border-gray-800 dark:bg-gray-800",children:[e.jsxs("h2",{className:"flex items-center gap-2 text-base font-bold text-gray-900 dark:text-white",children:[e.jsx(M,{className:"h-4 w-4 text-green-600"}),"Activity Breakdown"]}),h.length>0?e.jsx("div",{className:"mt-4 space-y-4",children:h.map(s=>{const j=a?s.hours/a*100:0;return e.jsxs("div",{children:[e.jsxs("div",{className:"mb-2 flex items-center justify-between gap-3 text-sm",children:[e.jsx("span",{className:"truncate font-medium text-gray-800 dark:text-gray-200",children:s.type}),e.jsx("span",{className:"flex-shrink-0 text-xs text-gray-500 dark:text-gray-400",children:l(s.hours)})]}),e.jsx(p,{value:j,className:"h-2"})]},s.type)})}):e.jsx("p",{className:"py-8 text-center text-sm text-gray-500 dark:text-gray-400",children:"No activity data yet."})]}),e.jsxs("section",{className:"rounded-2xl border border-gray-100 bg-white p-4 shadow-sm dark:border-gray-800 dark:bg-gray-800",children:[e.jsx("h2",{className:"text-base font-bold text-gray-900 dark:text-white",children:"Recent Activity"}),u.length>0?e.jsx("div",{className:"mt-3 space-y-2",children:u.map(s=>e.jsxs("div",{className:"flex items-center justify-between gap-3 rounded-xl bg-gray-50 p-3 dark:bg-gray-900",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"truncate text-sm font-semibold text-gray-900 dark:text-white",children:s.activityType}),e.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:F(new Date(s.date),"MMM d, yyyy")})]}),e.jsx("span",{className:"rounded-full bg-green-50 px-2.5 py-1 text-xs font-semibold text-green-700 dark:bg-green-950/40 dark:text-green-300",children:l(s.hours)})]},s.id))}):e.jsx("p",{className:"py-8 text-center text-sm text-gray-500 dark:text-gray-400",children:"No recent entries"})]})]})}function D(r,t){return P({queryKey:["member-stats",r,t],queryFn:()=>B.getStats(r,t)})}function K(){var m,h,u,s,j,N;const{data:r,isLoading:t}=D();if(T())return e.jsx(A,{stats:r,isLoading:t});if(t)return e.jsx("div",{className:"text-center py-12",children:e.jsx("p",{className:"text-muted-foreground",children:"Loading statistics..."})});const n=r!=null&&r.totalHours?r.materialParticipationHours/r.totalHours*100:0;return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-3xl font-bold tracking-tight",children:"My Statistics"}),e.jsx("p",{className:"text-muted-foreground mt-2",children:"Your personal time tracking analytics"})]}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-4",children:[e.jsxs(d,{children:[e.jsxs(c,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(x,{className:"text-sm font-medium",children:"Total Hours"}),e.jsx(w,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(o,{children:[e.jsxs("div",{className:"text-2xl font-bold",children:[((m=r==null?void 0:r.totalHours)==null?void 0:m.toFixed(1))||0,"h"]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"All time"})]})]}),e.jsxs(d,{children:[e.jsxs(c,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(x,{className:"text-sm font-medium",children:"This Week"}),e.jsx(k,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(o,{children:[e.jsxs("div",{className:"text-2xl font-bold",children:[((h=r==null?void 0:r.thisWeekHours)==null?void 0:h.toFixed(1))||0,"h"]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Current week"})]})]}),e.jsxs(d,{children:[e.jsxs(c,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(x,{className:"text-sm font-medium",children:"This Month"}),e.jsx(C,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(o,{children:[e.jsxs("div",{className:"text-2xl font-bold",children:[((u=r==null?void 0:r.thisMonthHours)==null?void 0:u.toFixed(1))||0,"h"]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Current month"})]})]}),e.jsxs(d,{children:[e.jsxs(c,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(x,{className:"text-sm font-medium",children:"Material Hours"}),e.jsx(v,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(o,{children:[e.jsxs("div",{className:"text-2xl font-bold",children:[((s=r==null?void 0:r.materialParticipationHours)==null?void 0:s.toFixed(1))||0,"h"]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[n.toFixed(0),"% of total"]})]})]})]}),e.jsxs(d,{children:[e.jsxs(c,{children:[e.jsx(x,{children:"Material Participation"}),e.jsx(b,{children:"Track your progress towards REPS material participation requirements"})]}),e.jsx(o,{className:"space-y-4",children:e.jsxs("div",{children:[e.jsxs("div",{className:"flex justify-between text-sm mb-2",children:[e.jsx("span",{className:"text-muted-foreground",children:"Material Hours"}),e.jsxs("span",{className:"font-medium",children:[(j=r==null?void 0:r.materialParticipationHours)==null?void 0:j.toFixed(1)," / ",(N=r==null?void 0:r.totalHours)==null?void 0:N.toFixed(1)," hours"]})]}),e.jsx(p,{value:n,className:"h-2"})]})})]}),e.jsxs(d,{children:[e.jsxs(c,{children:[e.jsxs(x,{className:"flex items-center gap-2",children:[e.jsx(M,{className:"w-5 h-5"}),"Activity Breakdown"]}),e.jsx(b,{children:"Distribution of hours by activity type"})]}),e.jsx(o,{children:r!=null&&r.activityBreakdown&&r.activityBreakdown.length>0?e.jsx("div",{className:"space-y-4",children:r.activityBreakdown.map((i,S)=>{const f=r.totalHours?i.hours/r.totalHours*100:0;return e.jsxs("div",{children:[e.jsxs("div",{className:"flex justify-between text-sm mb-2",children:[e.jsx("span",{className:"font-medium",children:i.type}),e.jsxs("span",{className:"text-muted-foreground",children:[i.hours.toFixed(1),"h (",f.toFixed(0),"%)"]})]}),e.jsx(p,{value:f,className:"h-2"})]},S)})}):e.jsx("p",{className:"text-center text-muted-foreground py-8",children:"No activity data yet. Start logging time entries to see your breakdown."})})]}),e.jsxs(d,{children:[e.jsxs(c,{children:[e.jsx(x,{children:"Recent Activity"}),e.jsx(b,{children:"Your last 5 time entries"})]}),e.jsx(o,{children:r!=null&&r.recentEntries&&r.recentEntries.length>0?e.jsx("div",{className:"space-y-3",children:r.recentEntries.map(i=>e.jsxs("div",{className:"flex items-center justify-between p-3 rounded-lg border",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:i.activityType}),e.jsx("p",{className:"text-sm text-muted-foreground",children:new Date(i.date).toLocaleDateString()})]}),e.jsx("div",{className:"text-right",children:e.jsxs("p",{className:"font-semibold",children:[i.hours,"h"]})})]},i.id))}):e.jsx("p",{className:"text-center text-muted-foreground py-8",children:"No recent entries"})})]})]})}export{K 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.