import{c as n,u,j as e,L as c}from"./index-7mCYgmGq.js";import{u as j,a as f}from"./api-DTr_VGP6.js";import{M as m}from"./MainLayout-DBQR6vfb.js";import{P as x}from"./ProgressRing-CRQHTFX7.js";import{B as h}from"./button-BfkoTqK7.js";import{m as s}from"./index-C5l5cIjg.js";import{C as N,T as v}from"./trophy-BbsNzOoQ.js";import{A as y}from"./arrow-right-nW0o5Pc0.js";/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const w=n("Flame",[["path",{d:"M8.5 14.5A2.5 2.5 0 0 0 11 12c0-1.38-.5-2-1-3-1.072-2.143-.224-4.054 2-6 .5 2.5 2 4.9 4 6.5 2 1.6 3 3.5 3 5.5a7 7 0 1 1-14 0c0-1.153.433-2.294 1-3a2.5 2.5 0 0 0 2.5 2.5z",key:"96xj49"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const b=n("Target",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"6",key:"1vlfrh"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const p=n("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"}]]),k={hidden:{opacity:0},show:{opacity:1,transition:{staggerChildren:.08}}},t={hidden:{opacity:0,y:20},show:{opacity:1,y:0,transition:{duration:.5}}};function F(){var o;const{user:a}=u(),{data:l,isLoading:g}=j({queryKey:["dashboard-stats",a==null?void 0:a.id],queryFn:f.getDashboardStats,enabled:!!a});if(g||!l)return e.jsx(m,{children:e.jsx("div",{className:"container max-w-6xl mx-auto px-4 py-20 flex items-center justify-center",children:e.jsx("div",{className:"w-8 h-8 border-4 border-primary border-t-transparent rounded-full animate-spin"})})});const{stats:r,continueLearning:d}=l;return e.jsx(m,{children:e.jsx("div",{className:"container max-w-6xl mx-auto px-4",children:e.jsxs(s.div,{variants:k,initial:"hidden",animate:"show",children:[e.jsxs(s.div,{variants:t,className:"mb-8",children:[e.jsxs("h1",{className:"font-heading text-4xl font-bold mb-2",children:["Welcome back, ",(o=a==null?void 0:a.name)==null?void 0:o.split(" ")[0]," 👋"]}),e.jsx("p",{className:"text-muted-foreground text-lg",children:"Here's your learning progress"})]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4 mb-8",children:[e.jsxs(s.div,{variants:t,whileHover:{y:-4},className:"glass-card rounded-2xl p-6 sm:col-span-2 sm:row-span-2 flex flex-col justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[e.jsx("div",{className:"w-10 h-10 rounded-xl gradient-primary flex items-center justify-center shadow-glow",children:e.jsx(b,{className:"w-5 h-5 text-primary-foreground"})}),e.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:"Overall Progress"})]}),e.jsx("div",{className:"flex items-center justify-center py-4",children:e.jsx(x,{progress:r.overallProgress,size:120,strokeWidth:8,showGlow:!0})}),e.jsxs("p",{className:"text-center text-sm text-muted-foreground mt-2",children:[r.totalCompletedSections," of ",r.totalAvailableSections," sections completed"]})]}),e.jsxs(s.div,{variants:t,whileHover:{y:-4},className:"glass-card rounded-2xl p-6",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[e.jsx(N,{className:"w-5 h-5 text-success"}),e.jsx("span",{className:"text-sm text-muted-foreground",children:"Completed"})]}),e.jsx("p",{className:"font-heading text-3xl font-bold",children:r.totalCompletedSections}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"sections done"})]}),e.jsxs(s.div,{variants:t,whileHover:{y:-4},className:"glass-card rounded-2xl p-6",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[e.jsx(v,{className:"w-5 h-5 text-warning"}),e.jsx("span",{className:"text-sm text-muted-foreground",children:"Enrolled"})]}),e.jsx("p",{className:"font-heading text-3xl font-bold",children:r.totalEnrolled}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"courses"})]}),e.jsxs(s.div,{variants:t,whileHover:{y:-4},className:"glass-card rounded-2xl p-6",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[e.jsx(w,{className:"w-5 h-5 text-destructive"}),e.jsx("span",{className:"text-sm text-muted-foreground",children:"Streak"})]}),e.jsx("p",{className:"font-heading text-3xl font-bold",children:r.streak}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"days"})]}),e.jsxs(s.div,{variants:t,whileHover:{y:-4},className:"glass-card rounded-2xl p-6",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[e.jsx(p,{className:"w-5 h-5 text-primary"}),e.jsx("span",{className:"text-sm text-muted-foreground",children:"Focus Score"})]}),e.jsxs("p",{className:"font-heading text-3xl font-bold",children:[r.focusScore,"%"]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"this week"})]})]}),e.jsxs(s.div,{variants:t,children:[e.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[e.jsx(p,{className:"w-5 h-5 text-primary"}),e.jsx("h2",{className:"font-heading text-xl font-semibold",children:"Continue Learning"})]}),d.length===0?e.jsxs("div",{className:"glass-card rounded-2xl p-10 text-center",children:[e.jsx("p",{className:"text-muted-foreground mb-4",children:"You haven't started any courses yet."}),e.jsx(h,{asChild:!0,className:"rounded-xl gradient-primary border-0 shadow-glow",children:e.jsx(c,{to:"/courses",children:"Browse Courses"})})]}):e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:d.map(i=>e.jsxs(s.div,{variants:t,whileHover:{y:-4,scale:1.01},transition:{type:"spring",stiffness:300,damping:20},className:"glass-card rounded-2xl p-5 flex items-center gap-4",children:[e.jsx(x,{progress:i.progress,size:56,strokeWidth:5,showGlow:!0}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("h3",{className:"font-heading font-semibold truncate",children:i.title}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:[i.completedSections,"/",i.totalSections," sections"]})]}),e.jsx(h,{asChild:!0,size:"icon",variant:"ghost",className:"rounded-xl",children:e.jsx(c,{to:`/courses/${i.id}`,children:e.jsx(y,{className:"w-4 h-4"})})})]},i.id))})]})]})})})}export{F as default};
