1var __IMPORT_META_ENV={};var __PROCESS_ENV={NODE_ENV:"production"}; 2import{b as H}from"/chunks/chunk-WWKZ3F7K.js";import{b as L,c as A}from"/chunks/chunk-AA7WURVV.js";import{g as i}from"/chunks/chunk-7EGBYURM.js";import"/chunks/chunk-VW2XFE4Z.js";import{a as c,c as Y,d as x,e as z,f as y,h as Q,i as X}from"/chunks/chunk-MJ2UO4XJ.js";import{A as se,B as ae,F as re,H as k,J as oe,L as P,e as f,f as D,i as w,l as Z,p as E,v as ee,z as te}from"/chunks/chunk-X5CSKBWX.js";import{d as B,e as Ne,f as K}from"/chunks/chunk-ABARTBUM.js";var a=B(Ne());var e=B(K());function he(){let _=H(),O=_.user?.profile.email||"",S=_.user?.profile.name||"",[s,j]=(0,a.useState)(null),[u,le]=(0,a.useState)([]),[I,de]=(0,a.useState)([]),[ie,ne]=(0,a.useState)([]),[me,ce]=(0,a.useState)(!0),[G,F]=(0,a.useState)(!1),[V,q]=(0,a.useState)(""),[C,J]=(0,a.useState)(""),[g,M]=(0,a.useState)(""),[b,U]=(0,a.useState)(""),[$,W]=(0,a.useState)(!1);(0,a.useEffect)(()=>{async function t(){try{let[o,l,p,n]=await Promise.all([c(y),c(Q),c(z),c(X)]),d=o.find(r=>r.fieldValues?.Email===O)||null;j(d);let m=x(d,"Name","Title")||d?.fieldValues?.["/text"]||S,N=l.filter(r=>r.fieldValues?.["Student Name"]===m).sort((r,v)=>(v.fieldValues?.["Booking Date"]||"").localeCompare(r.fieldValues?.["Booking Date"]||""));le(N);let h=n.filter(r=>r.fieldValues?.["Student Name"]===m).map(r=>r.fieldValues?.["Teacher Name"]),R=p.filter(r=>{let v=x(r,"Name","Title")||r.fieldValues?.["/text"]||"";return h.includes(v)||N.some(be=>be.fieldValues?.["Teacher Name"]===v)});de(R),ne(n)}catch{}ce(!1)}t()},[O,S]);let ue=()=>{s&&(q(s.fieldValues?.Phone||""),J(s.fieldValues?.["Locality/Area"]||""),M(s.fieldValues?.["Class Level"]||""),U(s.fieldValues?.Board||""),F(!0))},pe=async()=>{if(s){W(!0);try{let t={};V&&(t.Phone=V),C&&(t["Locality/Area"]=C),g&&(t["Class Level"]=L[g]||g),b&&(t.Board=A[b]||b),await Y(y,s.id,t),F(!1);let o=await c(y);j(o.find(l=>l.id===s.id)||s)}catch{}W(!1)}};if(me)return(0,e.jsx)("div",{className:"flex items-center justify-center py-20",children:(0,e.jsx)("div",{className:"genesis__spinner-ring"})});let T=x(s,"Name","Title")||s?.fieldValues?.["/text"]||S||"Student",xe=u.filter(t=>t.fieldValues?.Status==="completed").length,fe=u.filter(t=>t.fieldValues?.Status==="confirmed"||t.fieldValues?.Status==="pending"),ge=ie.filter(t=>t.fieldValues?.["Student Name"]===T).length;return(0,e.jsxs)("div",{className:"mx-auto max-w-7xl px-4 sm:px-6 py-8",children:[(0,e.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between mb-8 gap-4",children:[(0,e.jsxs)("div",{children:[(0,e.jsx)("h1",{className:"text-2xl sm:text-3xl font-bold",children:"Student Dashboard"}),(0,e.jsxs)("p",{className:"text-sm text-muted-foreground",children:["Welcome back, ",T]})]}),(0,e.jsxs)(i,{to:"/request",className:"inline-flex items-center gap-2 rounded-xl bg-primary px-5 py-2.5 text-sm font-semibold text-primary-foreground hover:opacity-90 transition-opacity min-h-11 shadow-lg shadow-primary/25",children:[(0,e.jsx)(f,{className:"h-4 w-4"})," Request a Tutor"]})]}),(0,e.jsx)("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3 mb-8",children:[{icon:f,label:"Classes Joined",value:String(u.length),sub:"All time",color:"text-blue-500",bg:"bg-blue-500/10"},{icon:D,label:"Upcoming",value:String(fe.length),sub:"Scheduled sessions",color:"text-green-500",bg:"bg-green-500/10"},{icon:oe,label:"Completed",value:String(xe),sub:"Finished classes",color:"text-emerald-500",bg:"bg-emerald-500/10"},{icon:k,label:"Reviews Given",value:String(ge),sub:"Your feedback",color:"text-amber-500",bg:"bg-amber-500/10"}].map(t=>{let o=t.icon;return(0,e.jsxs)("div",{className:"rounded-2xl border border-border bg-card p-4 hover:shadow-md transition-shadow",children:[(0,e.jsx)("div",{className:`flex h-9 w-9 items-center justify-center rounded-xl ${t.bg} mb-3`,children:(0,e.jsx)(o,{className:`h-5 w-5 ${t.color}`})}),(0,e.jsx)("p",{className:"text-xl font-bold tabular-nums",children:t.value}),(0,e.jsx)("p",{className:"text-xs text-muted-foreground",children:t.label}
2),(0,e.jsx)("p",{className:"text-[10px] text-muted-foreground/60",children:t.sub})]},t.label)})}),(0,e.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6 mb-8",children:[(0,e.jsxs)("div",{className:"rounded-2xl border border-border bg-card p-6",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,e.jsxs)("h3",{className:"font-semibold text-sm flex items-center gap-2",children:[(0,e.jsx)(P,{className:"h-4 w-4 text-primary"})," My Details"]}),G?(0,e.jsxs)("button",{onClick:pe,disabled:$,className:"inline-flex items-center gap-1 text-xs text-green-600 hover:underline min-h-8",children:[(0,e.jsx)(se,{className:"h-3 w-3"})," ",$?"Saving...":"Save"]}):(0,e.jsxs)("button",{onClick:ue,className:"inline-flex items-center gap-1 text-xs text-primary hover:underline min-h-8",children:[(0,e.jsx)(re,{className:"h-3 w-3"})," Edit"]})]}),(0,e.jsxs)("div",{className:"space-y-3 text-sm",children:[(0,e.jsxs)("div",{className:"flex items-center gap-3 py-2 border-b border-border/50",children:[(0,e.jsx)(P,{className:"h-4 w-4 text-muted-foreground shrink-0"}),(0,e.jsxs)("div",{className:"flex-1",children:[(0,e.jsx)("span",{className:"text-xs text-muted-foreground",children:"Name"}),(0,e.jsx)("p",{className:"font-medium",children:T})]})]}),(0,e.jsxs)("div",{className:"flex items-center gap-3 py-2 border-b border-border/50",children:[(0,e.jsx)(te,{className:"h-4 w-4 text-muted-foreground shrink-0"}),(0,e.jsxs)("div",{className:"flex-1",children:[(0,e.jsx)("span",{className:"text-xs text-muted-foreground",children:"Phone"}),(0,e.jsx)("p",{className:"font-medium",children:s?.fieldValues?.Phone||"Not set"})]})]}),(0,e.jsxs)("div",{className:"flex items-center gap-3 py-2 border-b border-border/50",children:[(0,e.jsx)(ee,{className:"h-4 w-4 text-muted-foreground shrink-0"}),(0,e.jsxs)("div",{className:"flex-1",children:[(0,e.jsx)("span",{className:"text-xs text-muted-foreground",children:"Area"}),(0,e.jsx)("p",{className:"font-medium",children:s?.fieldValues?.["Locality/Area"]||"Not set"})]})]}),(0,e.jsxs)("div",{className:"flex items-center gap-3 py-2 border-b border-border/50",children:[(0,e.jsx)(E,{className:"h-4 w-4 text-muted-foreground shrink-0"}),(0,e.jsxs)("div",{className:"flex-1",children:[(0,e.jsx)("span",{className:"text-xs text-muted-foreground",children:"Class"}),(0,e.jsx)("p",{className:"font-medium",children:s?.fieldValues?.["Class Level"]||"Not set"})]})]}),(0,e.jsxs)("div",{className:"flex items-center gap-3 py-2",children:[(0,e.jsx)(f,{className:"h-4 w-4 text-muted-foreground shrink-0"}),(0,e.jsxs)("div",{className:"flex-1",children:[(0,e.jsx)("span",{className:"text-xs text-muted-foreground",children:"Board"}),(0,e.jsx)("p",{className:"font-medium",children:s?.fieldValues?.Board||"Not set"})]})]})]}),G&&(0,e.jsxs)("div",{className:"mt-4 space-y-3 border-t border-border pt-4",children:[(0,e.jsx)("input",{value:V,onChange:t=>q(t.target.value),placeholder:"Phone",type:"tel",className:"w-full rounded-lg border border-border bg-background px-3 py-2 text-xs outline-none focus:border-primary/50"}),(0,e.jsx)("input",{value:C,onChange:t=>J(t.target.value),placeholder:"Area/Locality",className:"w-full rounded-lg border border-border bg-background px-3 py-2 text-xs outline-none focus:border-primary/50"}),(0,e.jsxs)("select",{value:g,onChange:t=>M(t.target.value),className:"w-full rounded-lg border border-border bg-background px-3 py-2 text-xs outline-none focus:border-primary/50",children:[(0,e.jsx)("option",{value:"",children:"Select Class"}),Object.keys(L).map(t=>(0,e.jsx)("option",{value:t,children:t},t))]}),(0,e.jsxs)("select",{value:b,onChange:t=>U(t.target.value),className:"w-full rounded-lg border border-border bg-background px-3 py-2 text-xs outline-none focus:border-primary/50",children:[(0,e.jsx)("option",{value:"",children:"Select Board"}),Object.keys(A).map(t=>(0,e.jsx)("option",{value:t,children:t},t))]})]})]}),(0,e.jsxs)("div",{className:"lg:col-span-2 rounded-2xl border border-border bg-card p-6",children:[(0,e.jsxs)("h3",{className:"font-semibold text-sm mb-4 flex items-center gap-2",children:[(0,e.jsx)(Z,{className:"h-4 w-4 text-primary"})," Class Schedule"]}),u.length===0?(0,e.jsxs)("div",{className:"text-center py-8",children:[(0,e.jsx)(D,{className:"h-8 w-8 text-muted-foreground
2/30 mx-auto mb-3"}),(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:"No classes yet."}),(0,e.jsx)(i,{to:"/find-tutor",className:"text-xs text-primary hover:underline mt-1 inline-block",children:"Find a tutor to get started"})]}):(0,e.jsx)("div",{className:"overflow-x-auto",children:(0,e.jsxs)("table",{className:"w-full text-sm",children:[(0,e.jsx)("thead",{children:(0,e.jsxs)("tr",{className:"border-b border-border",children:[(0,e.jsx)("th",{className:"text-left py-2.5 px-2 text-xs font-medium text-muted-foreground",children:"Teacher"}),(0,e.jsx)("th",{className:"text-left py-2.5 px-2 text-xs font-medium text-muted-foreground",children:"Subject"}),(0,e.jsx)("th",{className:"text-left py-2.5 px-2 text-xs font-medium text-muted-foreground",children:"Date"}),(0,e.jsx)("th",{className:"text-left py-2.5 px-2 text-xs font-medium text-muted-foreground",children:"Time"}),(0,e.jsx)("th",{className:"text-left py-2.5 px-2 text-xs font-medium text-muted-foreground",children:"Fee"}),(0,e.jsx)("th",{className:"text-left py-2.5 px-2 text-xs font-medium text-muted-foreground",children:"Status"})]})}),(0,e.jsx)("tbody",{children:u.map(t=>{let o=t.fieldValues?.Status==="confirmed",l=t.fieldValues?.Status==="completed",p=t.fieldValues?.Status==="pending",n=o,d=l,m=p,N=Number(t.fieldValues?.["Fee (\u20B9)"]||"0"),h=t.fieldValues?.["Booking Date"]||"",R=h?new Date(h).toLocaleDateString("en-IN",{day:"numeric",month:"short"}):"";return(0,e.jsxs)("tr",{className:"border-b border-border last:border-0 hover:bg-muted/30 transition-colors",children:[(0,e.jsx)("td",{className:"py-2.5 px-2 font-medium",children:t.fieldValues?.["Teacher Name"]}),(0,e.jsx)("td",{className:"py-2.5 px-2 text-muted-foreground",children:t.fieldValues?.Subject}),(0,e.jsx)("td",{className:"py-2.5 px-2 text-muted-foreground",children:R}),(0,e.jsx)("td",{className:"py-2.5 px-2 text-muted-foreground",children:t.fieldValues?.["Time Slot"]}),(0,e.jsxs)("td",{className:"py-2.5 px-2",children:["\u20B9",N]}),(0,e.jsx)("td",{className:"py-2.5 px-2",children:(0,e.jsx)("span",{className:`inline-flex items-center rounded-full px-2 py-0.5 text-xs font-medium ${n?"bg-green-500/10 text-green-600":m?"bg-amber-500/10 text-amber-600":d?"bg-blue-500/10 text-blue-600":"bg-red-500/10 text-red-600"}`,children:t.fieldValues?.Status})})]},t.id)})})]})})]})]}),(0,e.jsxs)("div",{className:"rounded-2xl border border-border bg-card p-6 mb-8",children:[(0,e.jsxs)("h3",{className:"font-semibold text-sm mb-4 flex items-center gap-2",children:[(0,e.jsx)(E,{className:"h-4 w-4 text-primary"})," My Teachers"]}),I.length===0?(0,e.jsx)("p",{className:"text-sm text-muted-foreground py-4",children:"No teachers yet. Once you book a class, they'll appear here."}):(0,e.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4",children:I.map(t=>{let o=x(t,"Name","Title")||t.fieldValues?.["/text"]||"Unknown",l=t.fieldValues?.Subject||"",p=Number(t.fieldValues?.Rating||"0"),n=t.fieldValues?.["Locality/Area"]||"",d=Number(t.fieldValues?.["Fees (\u20B9/hr)"]||"0"),m=t.fieldValues?.Verification==="verified";return(0,e.jsxs)(i,{to:`/tutor/${t.id}`,className:"group rounded-2xl border border-border bg-card p-4 hover:border-primary/30 hover:shadow-md transition-all",children:[(0,e.jsxs)("div",{className:"flex items-center gap-3 mb-3",children:[(0,e.jsx)("div",{className:"flex h-10 w-10 items-center justify-center rounded-xl bg-gradient-to-br from-blue-500 to-purple-600 text-white font-bold shrink-0",children:o.charAt(0)}),(0,e.jsxs)("div",{className:"min-w-0",children:[(0,e.jsx)("p",{className:"font-semibold text-sm truncate",children:o}),(0,e.jsxs)("div",{className:"flex items-center gap-1",children:[(0,e.jsx)(k,{className:"h-3 w-3 fill-amber-400 text-amber-400"}),(0,e.jsx)("span",{className:"text-xs",children:p.toFixed(1)}),m&&(0,e.jsx)("span",{className:"text-[10px] text-green-600",children:"\u2713"})]})]})]}),(0,e.jsxs)("div",{className:"text-xs text-muted-foreground space-y-1",children:[(0,e.jsxs)("p",{children:[l," \xB7 ",n]}),(0,e.jsxs)("p",{className:"font-semibold text-foreground",children:["\u20B9",d,"/hr"]})]})]},t.id)})})]}),(0,e.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[(0,e.jsxs)(i,{to:"/find-tutor",className:"rounded-2xl border border-border bg-card p-5 hover:border-primary/30 hover:shadow-md transition-all flex items-center gap-4",children:[(0,e.jsx)(ae,{className:"h-5 w-5 text-primary"}),(0,e.jsxs)("div",{className:"flex-1",children:[(0,e.jsx)("p",{className:"text-sm font-semibold",children:"Find a Tutor"}),(0,e.jsx)("p",{className:"text-xs text-muted-foreground",children:"Browse all teachers"})]}),(0,e.jsx)(w,{className:"h-4 w-4 text-muted-foreground"})]}),(0,e.jsxs)(i,{to:"/request",className:"rounded-2xl border border-border bg-card p-5 hover:border-primary/30 hover:shadow-md transition-all flex items-center gap-4",children:[(0,e.jsx)(f,{className:"h-5 w-5 text-primary"}),(0,e.jsxs)("div",{className:"flex-1",children:[(0,e.jsx)("p",{className:"text-sm font-semibold",children:"Request a Tutor"}),(0,e.jsx)("p",{className:"text-xs text-muted-foreground",children:"Get matched quickly"})]}),(0,e.jsx)(w,{className:"h-4 w-4 text-muted-foreground"})]}),(0,e.jsxs)(i,{to:"/reviews",className:"rounded-2xl border border-border bg-card p-5 hover:border-primary/30 hover:shadow-md transition-all flex items-center gap-4",children:[(0,e.jsx)(k,{className:"h-5 w-5 text-primary"}),(0,e.jsxs)("div",{className:"flex-1",children:[(0,e.jsx)("p",{className:"text-sm font-semibold",children:"Write a Review"}),(0,e.jsx)("p",{className:"text-xs text-muted-foreground",children:"Rate your teacher"})]}),(0,e.jsx)(w,{className:"h-4 w-4 text-muted-foreground"})]})]})]})}export{he 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.