PageSourceSearch

https://logic.lk/assets/dashboard-CWFE0i_k.js

js logic.lk collected 2026-10-08 07:21:05 UTC 29,319 bytes, 1 lines download raw bytes

1import{a as e}from"./rolldown-runtime-CCT_m2FY.js";import{d as t,i as s}from"./react-Fyjr9G8a.js";import{A as a,At as r,D as l,I as i,St as n,X as c,ct as d,d as o,ft as x,mt as m,pt as p,t as h,yt as g}from"./lucide-Du5NTjuW.js";import{l as f,s as u}from"./motion-DIT2RfQy.js";import{n as b}from"./auth-context-kM9U-ZIA.js";import{a as j,i as y,n as N,o as w,r as v,s as k,t as S}from"./recharts-CkRQ1xX0.js";import{t as z}from"./utils-CbNGOHui.js";import{t as D}from"./tgs-loader-CNcyYf3s.js";import{a as L,d as M,i as $,n as A,p as W,s as C,u as T}from"./api-CDoApT6I.js";import{t as E}from"./student-index-badge-CnLmddQ9.js";var Y=e(r(),1),_=f();function I(e){const t=Math.floor(e/60),s=e%60;return s?`${t}h ${s}m`:`${t}h`}function U(){const{user:e}=b(),[t,s]=(0,Y.useState)(new Date),[r,l]=(0,Y.useState)([]),[n,c]=(0,Y.useState)(null),[d,o]=(0,Y.useState)(!1);(0,Y.useEffect)(()=>{D(()=>o(!0))},[]);const x=e?.examYear?`${e.examYear.replace(/\s*A\/L\s*$/i,"").trim()} A/L`:void 0;(0,Y.useEffect)(()=>{M.getUpcoming(x).then(({sessions:e})=>l(e)).catch(()=>{})},[x]);const h=new Date,g=t.getMonth(),f=t.getFullYear(),u=g===h.getMonth()&&f===h.getFullYear(),j=h.getDate(),y=new Date(f,g+1,0).getDate(),N=new Date(f,g,1).getDay(),w=t.toLocaleString("default",{month:"short"}).toUpperCase(),v=new Map;for(const a of r){const e=new Date(a.dateTime);if(e.getMonth()===g&&e.getFullYear()===f){const t=e.getDate();v.has(t)||v.set(t,[]),v.get(t)?.push(a)}}const k=n??(u?j:null),S=k?v.get(k)??[]:[];return(0,_.jsxs)("section",{className:"bg-white rounded-3xl p-6 md:p-8 border border-gray-200 h-full flex flex-col",children:[(0,_.jsxs)("div",{className:"w-full flex items-center justify-between mb-6",children:[(0,_.jsxs)("h3",{className:"font-semibold text-sm uppercase tracking-wider text-muted-foreground flex items-center gap-2",children:[d?(0,_.jsx)("tgs-player",{autoplay:!0,loop:!0,mode:"normal",src:"/animations/calander.tgs",style:{width:"20px",height:"20px"}}):(0,_.jsx)("div",{className:"size-4 rounded-full bg-white animate-pulse"}),"Time Table"]}),(0,_.jsxs)("div",{className:"flex items-center gap-2",children:[(0,_.jsx)("button",{type:"button",onClick:()=>s(new Date(f,g-1,1)),className:"p-1 hover:bg-gray-100 rounded-full transition-colors text-gray-400 hover:text-gray-900",children:(0,_.jsx)(m,{className:"size-4"})}),(0,_.jsxs)("span",{className:"text-[10px] font-semibold text-primary bg-primary/5 px-3 py-1 rounded-full uppercase tracking-tighter min-w-[70px] text-center",children:[w," ",f]}),(0,_.jsx)("button",{type:"button",onClick:()=>s(new Date(f,g+1,1)),className:"p-1 hover:bg-gray-100 rounded-full transition-colors text-gray-400 hover:text-gray-900",children:(0,_.jsx)(p,{className:"size-4"})})]})]}),(0,_.jsx)("div",{className:"grid grid-cols-7 gap-1 w-full text-center text-xs font-semibold text-gray-400 mb-4 tracking-tighter",children:["SUN","MON","TUE","WED","THU","FRI","SAT"].map(e=>(0,_.jsx)("div",{children:e},e))}),(0,_.jsxs)("div",{className:"grid grid-cols-7 gap-3 w-full text-center place-items-center",children:[Array.from({length:N}).map((e,t)=>(0,_.jsx)("div",{className:"size-10"},`empty-${t}`)),Array.from({length:y}).map((e,t)=>{const s=t+1,a=u&&s===j,r=(v.get(s)??[]).length>0,l=s===n;return(0,_.jsxs)("button",{type:"button",onClick:()=>c(s===n?null:s),className:z("size-10 rounded-2xl flex flex-col items-center justify-center text-sm font-semibold transition-all relative",a?"bg-primary text-white scale-110 z-10":l?"bg-primary/15 text-primary ring-2 ring-primary/30":"bg-gray-50 hover:bg-gray-100 text-gray-900 border border-gray-100"),children:[s,r&&!a&&(0,_.jsx)("span",{className:z("absolute bottom-1.5 w-4 h-[3px] rounded-full",l?"bg-primary":"bg-amber-400")})]},`day-${s}`)})]}),S.length>0&&(0,_.jsx)("div",{className:"mt-5 pt-4 border-t border-gray-50 space-y-2",children:S.map(e=>{return(0,_.jsxs)("div",{className:"flex items-start gap-3 rounded-2xl bg-gray-50 border border-gray-100 px-3.5 py-3",children:[(0,_.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,_.jsx)("p",{className:"text-[12px] font-bold text-gray-900 truncate",children:e.className}),e.topic&&(0,_.jsx)("p",{className:"text-[10px] text-gray-500 truncate",children:e.topic}),(0,_.jsxs)("div",{className:"flex items-center gap-2 mt-1",children:[(0,_.jsxs)("span",{className:"text-[10px] font-medium text-gray-400",children:[(t=e.dateTime,new Date(t).toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",hour12:!0}))," · ",I(e.duration)]}),(0,_.jsxs)("span",{className:"flex items-center gap-0.5 text-[10px] text-gray-400 font-medium",children:["online"===e.type?(0,_.jsx)(a,{className:"size-2.5"}):(0,_.jsx)(i,{className:"size-2.5"}),"online"===e.type?"Online":e.location||"Physical"]})]})]}),(0,_.jsx)("span",{className:z("text-[9px] font-bold px-2 py-0.5 rounded-full uppercase tracking-wide shrink-0 mt-0.5","rescheduled"===e.status?"bg-amber-100 text-amber-700":"cancelled"===e.status?"bg-red-100 text-red-500":"bg-primary/10 text-primary"),children:e.status})]},e.id);var t})}),(0,_.jsxs)("div",{className:"w-full mt-5 grid grid-cols-2 gap-2 border-t border-gray-50 pt-5",children:[(0,_.jsxs)("div",{className:"flex items-center gap-2",children:[(0,_.jsx)("div",{className:"size-2 roun
1ded-full bg-primary"}),(0,_.jsx)("span",{className:"text-[10px] font-semibold text-gray-400 uppercase tracking-widest",children:"TODAY"})]}),(0,_.jsxs)("div",{className:"flex items-center gap-2",children:[(0,_.jsx)("div",{className:"size-2 rounded-full bg-amber-400"}),(0,_.jsx)("span",{className:"text-[10px] font-semibold text-gray-400 uppercase tracking-widest",children:"CLASS DAY"})]})]})]})}function B(e){if(!e)return"";const t=Math.floor(e/60),s=e%60;return t>0?`${t}:${String(s).padStart(2,"0")}:00`:`${String(s).padStart(2,"0")}:00`}function O(){const[e,t]=(0,Y.useState)(null);(0,Y.useEffect)(()=>{W.getLastWatched().then(e=>t(e.recording)).catch(()=>t(null))},[]);const a=e?.thumbnail||(e?.videoUrl?function(e){const t=e?.match(/(?:youtube\.com\/(?:watch\?v=|embed\/)|youtu\.be\/)([a-zA-Z0-9_-]{11})/);return t?`https://i.ytimg.com/vi/${t[1]}/maxresdefault.jpg`:""}(e.videoUrl):"");return e?(0,_.jsxs)("section",{className:"bg-white rounded-3xl p-6 md:p-8 border border-gray-200 flex-1 flex flex-col",children:[(0,_.jsx)("div",{className:"flex items-center justify-between mb-4",children:(0,_.jsxs)("h3",{className:"font-semibold text-lg flex items-center gap-2",children:[(0,_.jsx)(d,{className:"size-5 text-primary"}),"Continue Watching"]})}),(0,_.jsxs)(s,{to:`/classes/${String(e.classId)}/recordings/${String(e._id)}`,className:"flex flex-col sm:flex-row gap-6 items-center flex-1 group",children:[(0,_.jsxs)("div",{className:"relative w-full sm:w-48 h-28 rounded-2xl overflow-hidden cursor-pointer shrink-0 border border-gray-100",children:[a?(0,_.jsx)("img",{src:a,alt:e.title,className:"w-full h-full object-cover group-hover:scale-105 transition-transform duration-500"}):(0,_.jsx)("div",{className:"w-full h-full bg-primary/5 flex items-center justify-center",children:(0,_.jsx)(d,{className:"size-10 text-primary/30"})}),(0,_.jsx)("div",{className:"absolute inset-0 bg-black/20 flex items-center justify-center group-hover:bg-black/30 transition-colors",children:(0,_.jsx)("div",{className:"size-10 rounded-full bg-white/30 flex items-center justify-center",children:(0,_.jsx)(d,{className:"size-5 text-white"})})}),e.duration>0&&(0,_.jsx)("div",{className:"absolute bottom-2 right-2 bg-black/60 text-white text-[10px] font-semibold px-2 py-1 rounded-md",children:B(e.duration)})]}),(0,_.jsxs)("div",{className:"flex-1 space-y-3 w-full",children:[(0,_.jsxs)("div",{children:[(0,_.jsx)("div",{className:"text-[10px] font-semibold text-primary uppercase tracking-widest mb-1",children:"Last Watched"}),(0,_.jsx)("h4",{className:"font-semibold text-gray-900 text-base leading-tight group-hover:text-primary transition-colors line-clamp-2",children:e.title})]}),e.description&&(0,_.jsx)("p",{className:"text-xs text-gray-500 line-clamp-2",children:e.description}),(0,_.jsx)("div",{className:"pt-1",children:(0,_.jsxs)("span",{className:"inline-flex items-center gap-1.5 text-[11px] font-semibold text-primary bg-primary/5 px-3 py-1.5 rounded-xl",children:[(0,_.jsx)(d,{className:"size-3"}),"Watch Again"]})})]})]})]}):(0,_.jsxs)("section",{className:"bg-white rounded-3xl p-6 md:p-8 border border-gray-200 flex-1 flex flex-col",children:[(0,_.jsx)("div",{className:"flex items-center justify-between mb-4",children:(0,_.jsxs)("h3",{className:"font-semibold text-lg flex items-center gap-2",children:[(0,_.jsx)(d,{className:"size-5 text-primary"}),"Continue Watching"]})}),(0,_.jsx)("div",{className:"flex-1 flex items-center justify-center py-6",children:(0,_.jsx)("p",{className:"text-sm text-gray-400 font-medium",children:"No watched videos yet. Start watching a class to continue here."})})]})}function F(){const[e,t]=(0,Y.useState)(!1),[a,r]=(0,Y.useState)([]);(0,Y.useEffect)(()=>{D(()=>t(!0))},[]),(0,Y.useEffect)(()=>{L.list().then(e=>r(e.notices.slice(0,4))).catch(()=>{})},[]);const l=a.filter(e=>"high"===e.priority).length;return(0,_.jsxs)("section",{className:"bg-white rounded-3xl p-6 md:p-8 border border-gray-200 h-full flex flex-col",children:[(0,_.jsxs)("div",{className:"flex items-center justify-between mb-5",children:[(0,_.jsxs)("div",{className:"flex items-center gap-3",children:[(0,_.jsx)("div",{className:"size-10 rounded-2xl bg-white flex items-center justify-center overflow-hidden",children:e?(0,_.jsx)("tgs-player",{autoplay:!0,loop:!0,mode:"normal",src:"/animations/notification.tgs",style:{width:"40px",height:"40px"}}):(0,_.jsx)("div",{className:"w-full h-full rounded-2xl bg-white animate-pulse"})}),(0,_.jsx)("h3",{className:"font-semibold text-lg",children:"Important Notices"})]}),l>0&&(0,_.jsxs)("span",{className:"bg-rose-100 text-rose-700 text-[10px] font-semibold px-2 py-1 rounded-full uppercase tracking-wider animate-pulse",children:[l," Urgent"]})]}),(0,_.jsx)("div",{className:"flex-1 flex flex-col",children:0===a.length?(0,_.jsxs)("div",{className:"flex-1 flex flex-col items-center justify-center text-center gap-2",children:[(0,_.jsx)(x,{className:"size-7 text-gray-200"}),(0,_.jsx)("p",{className:"text-sm text-gray-400 font-medium",children:"No notices right now"})]}):(0,_.jsx)("div",{className:"space-y-2",children:a.map(e=>{const{Icon:t,color:s,bg:a}="high"===(r=e.priority)?{Icon:h,color:"text-rose-500",bg:"bg-rose-50"}:"low"===r?{Icon:c,color:"text-blue-500",bg:"bg-blue-50"}:{Icon:g,color:"text-amber-500",bg:"bg-amber-50"};var r,l;return(0,_.jsxs)("div",{className:"flex items-start gap-3 p-3 rounded-2xl hover:bg-gray-50 transition-colors cursor-pointer group border border-transparent hover:border-gray-100",children:[(0,_.jsx)("div",{className:z("size-9 rounded-xl flex items-center justify-center shrink-0 transition-transform group-hover:scale-110",a,s),children:(0,_.jsx)(t,{className:"size-4"})}),(0,_.jsxs)("div",{className:"flex-1 min-w-0 pt-0.5",children:[(0,_.jsx)("h4",{className:"text-sm font-semibold text-gray-900 leading-tight line-clamp-1",children:e.title}),(0,_.jsx)("p",{className:"text-[11px] font-medium text-gray-500 leading-snug line-clamp-1 mt-0.5",children:e.content})]}),(0,_.jsx)("span",{className:"text-[10px] text-gray-300 font-medium shrink-0 pt-1",children:(l=e.createdAt,new Date(l).toLocaleDateString("en-GB",{day:"numeric",month:"short"}))})]},e._id)})})}),(0,_.jsx)(s,{to:"/notices",className:"mt-4 pt-4 border-t border-gray-50 text-xs font-semibold text-primary hover:text-primary/80 transition-colors text-center block",children:"View all notices →"})]})}function H(e,t){if(!e)return`#${t+1}`;const s=e.trim().split(/\s+/).filter(e=>!/^\d{4}$/.test(e)),a=s.filter(e=>/[a-zA-Z]/.test(e)).map(e=>e[0].toUpperCase()).join(""),r=s.findLast(e=>/^\d+$/.test(e));return`${a}${r?String(Number(r)):""}`}function P({active:e,payload:t}){if(!e||!t?.length)return null;const s=t[0].payload;return(0,_.jsxs)("div",{style:{background:"white",border:"1px solid #f3f4f6",borderRadius:16,padding:"10px 14px",boxShadow:"0 10px 25px -5px rgb(0 0 0 / 0.12)",minWidth:140},children:[(0,_.jsx)("p",{style:{color:"#6b7280",fontWeight:600,fontSize:10,textTransform:"uppercase",letterSpacing:"0.05em",marginBottom:4},children:s.fullName}),(0,_.jsxs)("p",{style:{color:"#ff2d55",fontWeight:700,fontSize:15,margin:0},children:[s.marks,"/",s.totalMarks,(0,_.jsxs)("span",{style:{fontSize:11,marginLeft:6,opacity:.7},children:[s.score,"%"]})]})]})}function G({marks:e,loading:t}){const[s,a]=(0,Y.useState)(!1);(0,Y.useEffect)(()=>{D(()=>a(!0))},[]);const r=[...e].sort((e,t)=>
1new Date(e.submittedAt).getTime()-new Date(t.submittedAt).getTime()).slice(-8).map((e,t)=>({label:H(e.paperName,t),fullName:e.paperName||`Paper ${t+1}`,score:Math.round(e.percentage??0),marks:e.marks,totalMarks:e.totalMarks}));return(0,_.jsxs)("section",{className:"bg-white rounded-3xl p-6 md:p-8 border border-gray-200 h-full flex flex-col",children:[(0,_.jsxs)("div",{className:"flex items-center justify-between mb-8",children:[(0,_.jsxs)("div",{className:"flex items-center gap-3",children:[(0,_.jsx)("div",{className:"size-10 rounded-2xl bg-white flex items-center justify-center overflow-hidden",children:s?(0,_.jsx)("tgs-player",{autoplay:!0,loop:!0,mode:"normal",src:"/animations/planchart.tgs",style:{width:"40px",height:"40px"}}):(0,_.jsx)("div",{className:"w-full h-full rounded-2xl bg-white animate-pulse"})}),(0,_.jsx)("h3",{className:"font-semibold text-lg",children:"Performance Graph"})]}),r.length>0&&(0,_.jsxs)("span",{className:"text-[10px] font-semibold uppercase tracking-wider text-gray-400",children:["Last ",r.length," Papers"]})]}),(0,_.jsx)("div",{className:"w-full relative flex-1",style:{minHeight:180},children:t?(0,_.jsx)("div",{className:"flex items-center justify-center h-full text-gray-300 text-sm font-medium tracking-wide",children:"Loading..."}):0===r.length?(0,_.jsxs)("div",{className:"flex flex-col items-center justify-center h-full gap-3 py-8",children:[(0,_.jsxs)("svg",{width:"52",height:"52",viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:[(0,_.jsx)("rect",{x:"3",y:"28",width:"11",height:"16",rx:"3",fill:"#e5e7eb"}),(0,_.jsx)("rect",{x:"18.5",y:"20",width:"11",height:"24",rx:"3",fill:"#e5e7eb"}),(0,_.jsx)("rect",{x:"34",y:"10",width:"11",height:"34",rx:"3",fill:"#fda4af"})]}),(0,_.jsx)("p",{className:"text-sm font-semibold text-gray-500",children:"No marks yet"}),(0,_.jsx)("p",{className:"text-xs text-gray-400 text-center max-w-[200px]",children:"Your performance graph will appear here once papers are marked."})]}):(0,_.jsx)("div",{className:"w-full h-full animate-in fade-in duration-500",children:(0,_.jsx)(k,{width:"100%",height:"100%",minWidth:0,minHeight:0,children:(0,_.jsxs)(S,{data:r,margin:{top:10,right:0,left:-20,bottom:0},children:[(0,_.jsx)("defs",{children:(0,_.jsxs)("linearGradient",{id:"colorScore",x1:"0",y1:"0",x2:"0",y2:"1",children:[(0,_.jsx)("stop",{offset:"5%",stopColor:"#ff2d55",stopOpacity:.3}),(0,_.jsx)("stop",{offset:"95%",stopColor:"#ff2d55",stopOpacity:0})]})}),(0,_.jsx)(j,{strokeDasharray:"3 3",vertical:!1,stroke:"#f3f4f6"}),(0,_.jsx)(v,{dataKey:"label",axisLine:!1,tickLine:!1,tick:{fill:"#9ca3af",fontSize:10,fontWeight:700},dy:10}),(0,_.jsx)(N,{axisLine:!1,tickLine:!1,tick:{fill:"#9ca3af",fontSize:10,fontWeight:700},domain:[0,100]}),(0,_.jsx)(w,{content:(0,_.jsx)(P,{}),cursor:{stroke:"#f3f4f6",strokeWidth:2}}),(0,_.jsx)(y,{type:"monotone",dataKey:"score",stroke:"#ff2d55",strokeWidth:4,fillOpacity:1,fill:"url(#colorScore)",activeDot:{r:6,strokeWidth:0,fill:"#ff2d55"},animationDuration:1500})]})})})})]})}var q=[{imgSrc:"/icons/recording.webp",label:"Recordings",to:"/my-classes"},{imgSrc:"/icons/my-class.webp",label:"My Classes",to:"/my-classes"},{imgSrc:"/icons/payment.webp",label:"Payments",to:"/payments"},{imgSrc:"/icons/marks.webp",label:"Marks",to:"/marks"}];function R(){const e=t();return(0,_.jsx)("div",{className:"lg:col-span-4 grid grid-cols-2 gap-4 h-full",children:q.map(t=>(0,_.jsxs)("button",{type:"button",onClick:()=>e(t.to),className:"bg-white p-6 rounded-3xl border border-gray-200 hover:border-primary transition-all group flex flex-col items-center justify-center gap-3",children:[(0,_.jsx)("div",{className:"size-10 rounded-2xl flex items-center justify-center transition-transform group-hover:scale-110",children:(0,_.jsx)("img",{src:t.imgSrc,alt:t.label,className:"size-8 object-contain"})}),(0,_.jsx)("span",{className:"font-semibold text-sm text-gray-700",children:t.label})]},t.label))})}function V({marks:e,loading:t}){const[s,a]=(0,Y.useState)(!1);(0,Y.useEffect)(()=>{D(()=>a(!0))},[]);const r=[...e].sort((e,t)=>(t.percentage??0)-(e.percentage??0)).slice(0,3);return(0,_.jsxs)("section",{className:"bg-white rounded-3xl p-6 md:p-8 border border-gray-200 h-full flex flex-col",children:[(0,_.jsx)("div",{className:"flex items-center justify-between mb-8",children:(0,_.jsxs)("div",{className:"flex items-center gap-3",children:[(0,_.jsx)("div",{className:"size-10 rounded-2xl bg-white flex items-center justify-center overflow-hidden",children:s?(0,_.jsx)("tgs-player",{autoplay:!0,loop:!0,mode:"normal",src:"/animations/rank.tgs",style:{width:"40px",height:"40px"}}):(0,_.jsx)("div",{className:"w-full h-full rounded-2xl bg-white animate-pulse"})}),(0,_.jsx)("h3",{className:"font-semibold text-lg",children:"Best Performance"})]})}),(0,_.jsx)("div",{className:"space-y-4 flex-1 flex flex-col justify-start",children:t?(0,_.jsx)("div",{className:"space-y-4",children:[1,2,3].map(e=>(0,_.jsxs)("div",{className:"flex items-center justify-between p-4 rounded-2xl border border-gray-100 bg-gray-50/50 animate-pulse",children:[(0,_.jsxs)("div",{className:"flex items-center gap-3",children:[(0,_.jsx)("div",{className:"size-9 rounded-full bg-gray-200 shrink-0"}),(0,_.jsxs)("div",{className:"space-y-2",children:[(0,_.jsx)("div",{className:"h-3 w-32 bg-gray-200 rounded-full"}),(0,_.jsx)("div",{className:"h-2.5 w-12 bg-gray-200 rounded-full"})]})]}),(0,_.jsx)("div",{className:"size-8 rounded-full bg-gray-200"})]},e))}):0===r.length?(0,_.jsxs)("div",{className:"flex flex-col items-center justify-center flex-1 gap-3 py-8",children:[(0,_.jsxs)("svg",{width:"52",height:"52",viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:[(0,_.jsx)("path",{d:"M11 10 H37 V24 C37 31 31 35 24 35 C17 35 11 31 11 24 V10 Z",stroke:"#d1d5db",strokeWidth:"2",strokeLinejoin:"round"}),(0,_.jsx)("path",{d:"M11 14 C6 14 6 24 11 24",stroke:"#d1d5db",strokeWidth:"2",strokeLinecap:"round",fill:"none"}),(0,_.jsx)("path",{d:"M37 14 C42 14 42 24 37 24",stroke:"#d1d5db",strokeWidth:"2",strokeLinecap:"round",fill:"none"}),(0,_.jsx)("line",{x1:"24",y1:"35",x2:"24",y2:"41",stroke:"#d1d5db",strokeWidth:"2",strokeLinecap:"round"}),(0,_.jsx)("rect",{x:"15",y:"41",width:"18",height:"3",rx:"1.5",fill:"#fde68a"})]}),(0,_.jsx)("p",{className:"text-sm font-semibold text-gray-500",children:"No marks yet"}),(0,_.jsx)("p",{className:"text-xs text-gray-400 text-center max-w-[200px]",children:"Your best performances will show up here after papers are marked."})]}):r.map((e,t)=>{const s="A"===(a=e.grade)?"emerald":"B"===a?"blue":"C"===a?"violet":"S"===a?"rose":"slate";var a;return(0,_.jsxs)("div",{className:"flex items-center justify-between p-4 rounded-2xl border border-gray-100 bg-gray-50/50",children:[(0,_.jsxs)("div",{className:"flex items-center gap-3",children:[(0,_.jsx)("div",{className:"flex flex-col items-center justify-center size-9 rounded-full bg-white border border-gray-200 shrink-0",children:(0,_.jsxs)("span",{className:"font-bold text-xs text-gray-900",children:["#",t+1]})}),(0,_.jsxs)("div",{children:[(0,_.jsx)("p",{className:"text-sm font-semibold text-gray-900 truncate max-w-[130px]",children:e.paperName||"—"}),(0,_.jsxs)("span",{className:"text-[10px] font-semibold text-gray-500 uppercase tracking-wider",children:[(e.percentage??0).toFixed(1),"%"]})]})]}),(0,_.jsx)("span",{className:z("text-sm font-bold w-8 h-8 rounded-full flex items-center justify-center border","emerald"===s&&"bg-emerald-50 text-emerald-700 border-emerald-200","blue"===s&&"bg-blue-50 text-blue-700 border-blue-200","violet"===s&&"bg-violet-50 text-violet-700 border-violet-200","rose"===s&&"bg-rose-50 text-rose-700 border-rose-200","slate"===s&&"bg-slate-50 text-slate-700 border-slate-200"),children:e.grade})]},e._id)})})]})}function Z({name:e,examDate:t,loading:s,enrolledCount:a,bestScore:r}){const i=t?Math.max(0,Math.ceil((new Date(t).getTime()-Date.now())/864e5)):null,c=t?(()=>{const e=new Date(new Date(t).getFullYear(),0,1).getTime(),s=new Date(t).getTime();return Math.min(100,Math.max(0,Math.round((Date.now()-e)/(s-e)*100)))})():null,[d,x]=(0,Y.useState)("අද දින ඔබ කරන කැපකිරීම හෙට දින ඔබේ සාර්ථකත්වයට මà¶
1œ පාදයි.");return(0,Y.useEffect)(()=>{A.get().then(({quote:e})=>{e?.quote&&x(e.quote)}).catch(()=>{})},[]),s?(0,_.jsxs)("div",{className:"lg:col-span-8 relative overflow-hidden rounded-[1.2rem] bg-gradient-to-br from-primary via-[#ff2d55] to-[#ff6b8b] p-6 md:p-10 min-h-[200px] flex flex-col justify-center border border-white/10",children:[(0,_.jsxs)("div",{className:"animate-pulse space-y-4 md:pr-60",children:[(0,_.jsxs)("div",{className:"flex items-center gap-3",children:[(0,_.jsx)("div",{className:"size-9 rounded-full bg-white/30"}),(0,_.jsx)("div",{className:"h-6 w-52 bg-white/30 rounded-full"})]}),(0,_.jsxs)("div",{className:"space-y-2 pt-1",children:[(0,_.jsx)("div",{className:"h-4 bg-white/20 rounded-full w-full"}),(0,_.jsx)("div",{className:"h-4 bg-white/20 rounded-full w-4/5"})]}),(0,_.jsxs)("div",{className:"flex gap-2 pt-3",children:[(0,_.jsx)("div",{className:"h-7 w-24 bg-white/30 rounded-full"}),(0,_.jsx)("div",{className:"h-7 w-24 bg-white/20 rounded-full"})]})]}),(0,_.jsx)("div",{className:"hidden md:block absolute right-8 top-1/2 -translate-y-1/2 z-20",children:(0,_.jsx)("div",{className:"w-52 h-44 rounded-3xl bg-white/15 animate-pulse"})})]}):(0,_.jsxs)("div",{className:"lg:col-span-8 relative overflow-hidden rounded-[1.2rem] bg-gradient-to-br from-primary via-[#ff2d55] to-[#ff6b8b] p-6 md:p-10 text-white group min-h-[200px] flex flex-col justify-center border border-white/10",children:[(0,_.jsxs)("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[(0,_.jsx)("div",{className:"absolute -top-[40%] -left-[20%] size-[140%] bg-[radial-gradient(circle_at_50%_50%,rgba(255,255,255,0.15)_0%,transparent_50%)] animate-pulse duration-[8s]"}),(0,_.jsx)("div",{className:"absolute top-[20%] -right-[20%] size-[100%] bg-[radial-gradient(circle_at_50%_50%,rgba(255,255,255,0.1)_0%,transparent_40%)] animate-pulse duration-[12s]"})]}),(0,_.jsx)("div",{className:"absolute inset-0 opacity-[0.12] pointer-events-none",style:{backgroundImage:"radial-gradient(circle, #fff 1.2px, transparent 1.2px)",backgroundSize:"12px 12px"}}),(0,_.jsx)("div",{className:"absolute inset-0 opacity-[0.04] pointer-events-none",style:{backgroundImage:"linear-gradient(rgba(255,255,255,0.5) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,0.5) 1px, transparent 1px)",backgroundSize:"48px 48px"}}),(0,_.jsx)("div",{className:"hidden md:flex absolute right-[-5%] top-1/2 -translate-y-1/2 items-center pointer-events-none",children:[.05,.1,.15,.25,.4].map((e,t)=>(0,_.jsx)(u.div,{initial:{opacity:0,scale:.9},animate:{opacity:e,scale:1},transition:{delay:.1*t,duration:.8},className:"size-28 md:size-40 rounded-[2rem] bg-white border border-white/30",style:{background:`linear-gradient(135deg, rgba(255,255,255,${e+.2}) 0%, rgba(255,255,255,0.1) 100%)`,marginLeft:t>0?"-85px":"0px"}},t))}),(0,_.jsx)("div",{className:"hidden md:flex absolute right-8 top-1/2 -translate-y-1/2 z-20 flex-col items-center justify-center",children:(0,_.jsxs)("div",{className:"relative flex flex-col items-center justify-center w-52 rounded-3xl border border-white/25 backdrop-blur-xl overflow-hidden",style:{background:"linear-gradient(135deg, rgba(255,255,255,0.18) 0%, rgba(255,255,255,0.06) 100%)"},children:[(0,_.jsx)("div",{className:"w-full h-1 bg-gradient-to-r from-white/0 via-white/60 to-white/0"}),(0,_.jsxs)("div",{className:"px-6 py-5 flex flex-col items-center gap-1 w-full",children:[(0,_.jsx)("span",{className:"text-[9px] uppercase tracking-[0.2em] font-bold opacity-60 text-white",children:"A/L Exam In"}),(0,_.jsxs)("div",{className:"relative flex items-end gap-1 leading-none",children:[(0,_.jsx)(u.span,{initial:{scale:.5,opacity:0},animate:{scale:1,opacity:1},transition:{type:"spring",stiffness:200},className:"text-8xl font-medium tracking-tighter text-white",style:{textShadow:"0 4px 24px rgba(0,0,0,0.18)"},children:i??"—"}),null!=i&&(0,_.jsx)("span",{className:"text-xl font-bold opacity-70 mb-2",children:"d"}),(0,_.jsx)("span",{className:"absolute -top-1 -right-3 size-2.5 bg-white rounded-full animate-pulse"})]}),(0,_.jsxs)("span",{className:"text-[10px] font-semibold opacity-60 text-center leading-relaxed text-white mt-1",children:["උසස් පෙළ විභාගයට",(0,_.jsx)("br",{}),"තව දින"]}),(0,_.jsx)("div",{className:"w-full mt-3 h-1 rounded-full bg-white/15",children:(0,_.jsx)(u.div,{initial:{width:0},animate:{width:null!=c?`${c}%`:"0%"},transition:{delay:.5,duration:1,ease:"easeOut"},className:"h-full rounded-full bg-white/70"})}),(0,_.jsx)("span",{className:"text-[8px] opacity-40 font-medium",children:null!=c?`${c}% of study year`:"Set exam date in settings"})]}),(0,_.jsx)("div",{className:"w-full h-1 bg-gradient-to-r from-white/0 via-white/30 to-white/0"})]})}),(0,_.jsxs)("div",{className:"relative z-10 space-y-4 md:pr-60",children:[(0,_.jsxs)("div",{className:"flex flex-wrap items-center gap-3",children:[(0,_.jsx)("div",{className:"size-9 rounded-full bg-white flex items-center justify-center",children:(0,_.jsx)(l,{className:"size-4 text-primary"})}),(0,_.jsxs)("h2",{className:"text-xl md:text-2xl font-semibold tracking-tight",children:["Welcome back, ",(0,_.jsx)("span",{className:"text-white",children:e})]})]}),null!=i&&(0,_.jsxs)("div",{className:"w-full rounded-xl bg-white/10 border border-white/20 backdrop-blur-md flex flex-row items-center justify-center gap-3 py-2.5 md:hidden",children:[(0,_.jsx)("span",{className:"text-2xl font-black tracking-tighter",children:i}),(0,_.jsx)("span",{className:"text-xs font-semibold opacity-70",children:"දින — A/L Exam"})]}),(0,_.jsx)("div",{className:"space-y-2",children:(0,_.jsxs)("p",{className:"text-base md:text-lg text-white font-medium max-w-xl leading-relaxed",children:['"',d,'"']})}),(0,_.jsxs)("div",{className:"flex flex-wrap items-center gap-2 pt-4",children:[(0,_.jsx)(E,{variant:"glass"}),null!=a&&(0,_.jsxs)(u.div,{whileHover:{scale:1.05,y:-1},className:"px-3 py-1.5 bg-white text-gray-900 rounded-full flex items-center gap-2",children:[(0,_.jsx)(n,{className:"size-3.5 text-primary shrink-0"}),(0,_.jsx)("span",{className:"text-[11px] font-semibold opacity-50",children:"Enrolled"}),(0,_.jsx)("span",{className:"text-[11px] font-bold",children:a})]}),null!=r&&(0,_.jsxs)(u.div,{whileHover:{scale:1.05,y:-1},className:"px-3 py-1.5 bg-white/15 border border-white/30 text-white rounded-full flex items-center gap-2 backdrop-blur-sm",children:[(0,_.jsx)(o,{className:"size-3.5 text-yellow-300 fill-yellow-300 shrink-0"}),(0,_.jsx)("span",{className:"text-[11px] font-semibold opacity-60",children:"Best"}),(0,_.jsxs)("span",{className:"text-[11px] font-bold",children:[r,"%"]})]})]})]}),(0,_.jsx)("div",{className:"absolute bottom-0 right-0 size-64 bg-white/10 blur-[80px] rounded-full pointer-events-none"})]})}function K(){const{user:e}=b(),[t,s]=(0,Y.useState)(null),[a,r]=(0,Y.useState)([]),[l,i]=(0,Y.useState)(!0),[n,c]=(0,Y.useState)(null);return(0,Y.useEffect)(()=>{T.getExamYears().then(t=>{if(e?.examYear){const a=e=>
1e.replace(/\s*A\/L\s*$/i,"").trim(),r=a(e.examYear),l=t.find(e=>a(e.value)===r);if(l?.examDate)return void s(l.examDate)}s(t.filter(e=>e.examDate).sort((e,t)=>new Date(e.examDate??"").getTime()-new Date(t.examDate??"").getTime()).find(e=>new Date(e.examDate??"").getTime()>Date.now())?.examDate??null)}).catch(()=>{}),$.list().then(e=>r(e.marks??[])).catch(()=>{}).finally(()=>i(!1)),C.list().then(e=>{const t=(e.payments??[]).filter(e=>"activated"===e.status).length;c(t)}).catch(()=>{})},[e?.examYear]),(0,_.jsxs)("div",{className:"space-y-6 animate-in fade-in duration-150 motion-reduce:animate-none",children:[(0,_.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-12 gap-6",children:[(0,_.jsx)(Z,{name:e?.firstName??"Student",examDate:t,loading:l,enrolledCount:n,bestScore:a.length>0?Math.round(Math.max(...a.map(e=>e.percentage??0))):null}),(0,_.jsx)(R,{})]}),(0,_.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-12 gap-6",children:[(0,_.jsx)("div",{className:"lg:col-span-8 h-full",children:(0,_.jsx)(G,{marks:a,loading:l})}),(0,_.jsx)("div",{className:"lg:col-span-4 h-full",children:(0,_.jsx)(U,{})}),(0,_.jsx)("div",{className:"lg:col-span-6 h-full",children:(0,_.jsx)(V,{marks:a,loading:l})}),(0,_.jsx)("div",{className:"lg:col-span-6 h-full",children:(0,_.jsx)(F,{})}),(0,_.jsx)("div",{className:"lg:col-span-12 h-full",children:(0,_.jsx)(O,{})})]})]})}export{K as StudentDashboard};

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.