PageSourceSearch

https://scheduler.revtrapeze.com/assets/ChildClassCard-C2aF9nKQ.js

js revtrapeze.com collected 2026-10-08 01:16:35 UTC 3,431 bytes, 1 lines download raw bytes

1import{ag as N,r as t,b as x,j as e,L as b,c as C,C as o,k as v,p as _,T as w}from"./index-DZkxZvkP.js";import{A as S}from"./arrow-left-Dmev4xjc.js";function z(){const{studentId:a}=N(),[n,g]=t.useState([]),[l,h]=t.useState(""),[u,f]=t.useState(!0);t.useEffect(()=>{a&&p()},[a]);async function p(){var s,c;try{const[r,j]=await Promise.all([x.getStudentClassCards(a),x.getLinkedStudents()]);g(((s=r.data)==null?void 0:s.cards)||[]);const m=(((c=j.data)==null?void 0:c.approved)||[]).find(y=>y.id===a);m&&h(m.name)}catch(r){console.error("Failed to load child class cards:",r)}finally{f(!1)}}if(u)return e.jsx("div",{className:"flex items-center justify-center py-12",children:e.jsx(b,{className:"animate-spin text-brand-500",size:32})});const d=n.filter(s=>s.remaining_count>0),i=n.filter(s=>s.remaining_count<=0);return e.jsxs("div",{className:"max-w-2xl mx-auto",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-6",children:[e.jsx(C,{to:"/family",className:"text-gray-400 hover:text-gray-600","aria-label":"Back to family",children:e.jsx(S,{size:20})}),e.jsx("h1",{className:"text-2xl font-bold text-gray-900",children:l?`${l}'s Class Cards`:"Child Class Cards"})]}),d.length===0&&i.length===0&&e.jsxs("div",{className:"text-center py-12 bg-gray-50 rounded-lg",children:[e.jsx(o,{size:48,className:"mx-auto text-gray-300 mb-4"}),e.jsx("p",{className:"text-gray-500",children:"No class cards for this student."})]}),d.map(s=>e.jsxs("div",{className:"bg-white border border-gray-200 rounded-lg p-6 mb-4 shadow-sm",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(o,{size:24,className:"text-brand-600"}),e.jsx("h2",{className:"font-semibold text-gray-900",children:"Class Card"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[(!!s.is_family||!!s.has_linked_users)&&e.jsx("span",{className:"text-xs px-2 py-0.5 rounded-full bg-brand-50 text-brand-700",children:"Shared"}),e.jsx("span",{className:"inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-green-100 text-green-800",children:"Active"})]})]}),e.jsx("div",{className:"mb-2",children:e.jsxs("div",{className:"text-2xl font-bold text-gray-900",children:[s.remaining_count," ",e.jsxs("span",{className:"text-base font-normal text-gray-500",children:[s.remaining_count===1?"class":"classes"," remaining"]})]})}),s.expires_at&&e.jsxs("p",{className:"text-xs text-gray-400 mt-2",children:["Expires ",v(_(s.expires_at),"MMM d, yyyy")]}),s.remaining_count<=2&&s.remaining_count>0&&e.jsxs("div",{className:"flex items-center gap-2 mt-3 text-amber-600 text-sm",children:[e.jsx(w,{size:14}),e.jsxs("span",{children:["Running low — ",s.remaining_count," class",s.remaining_count!==1?"es":""," left"]})]})]},s.id)),i.length>0&&e.jsxs("div",{className:"mt-8",children:[e.jsx("h3",{className:"text-sm font-medium text-gray-500 uppercase tracking-wide mb-3",children:"Past Cards"}),i.map(s=>e.jsx("div",{className:"bg-gray-50 border border-gray-200 rounded-lg p-4 mb-2 opacity-60",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{className:"text-sm text-gray-600",children:["Class Card · ",s.lifetime_purchased," ",s.lifetime_purchased===1?"class":"classes"," purchased lifetime"]}),e.jsx("span",{className:"text-xs text-gray-400",children:"Used up"})]})},s.id))]})]})}export{z 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.