PageSourceSearch

https://tresda.institute/assets/Labs-Cvnv3S5H.js

js tresda.institute collected 2026-10-02 01:59:16 UTC 5,372 bytes, 1 lines download raw bytes

1import{j as e,L as f,af as h,U as j,ak as N,r as d,m as c,b as u,cz as v}from"./index-u0HMC9Vb.js";const p={upcoming:{label:"Upcoming",color:"#B45309",bg:"#FFFBEB"},active:{label:"Open",color:"#15803D",bg:"#F0FDF4"},completed:{label:"Completed",color:"#64748B",bg:"#F8FAFC"},draft:{label:"Draft",color:"#94A3B8",bg:"#F8FAFC"}},y={visualisation:"Visualisation Lab",portfolio:"Portfolio Lab",presentation:"Presentation Lab",branding:"Branding Lab",spatial:"Spatial Lab",other:"Lab"};function L({lab:s,isEnrolled:i}){const r=p[s.status]||p.upcoming,a=y[s.lab_type]||"Lab",o=s.price>0?`£${s.price}`:"Free",n=s.lab_type==="visualisation"?"/labs/visualisation":`/labs/${s.id}`;return e.jsx(f,{to:n,children:e.jsxs("div",{className:"group border border-border bg-card hover:border-foreground/30 transition-all duration-200 h-full flex flex-col cursor-pointer",children:[e.jsxs("div",{className:"aspect-video bg-muted overflow-hidden flex-shrink-0 relative",children:[s.cover_image_url?e.jsx("img",{src:s.cover_image_url,alt:s.title,className:"w-full h-full object-cover group-hover:scale-[1.02] transition-transform duration-300"}):e.jsx("div",{className:"w-full h-full flex items-center justify-center",children:e.jsx("span",{className:"text-[10px] font-meta tracking-widest text-muted-foreground/30",children:a.toUpperCase()})}),e.jsx("div",{className:"absolute top-2 right-2 px-2 py-0.5 text-[10px] font-meta",style:{background:r.bg,color:r.color},children:r.label})]}),e.jsxs("div",{className:"p-4 flex flex-col flex-1 gap-2",children:[e.jsx("p",{className:"text-[10px] text-muted-foreground/60 font-meta",children:a}),e.jsx("h3",{className:"text-sm font-semibold text-foreground leading-snug",children:s.title}),s.description&&e.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed line-clamp-2",children:s.description}),e.jsxs("div",{className:"mt-auto pt-3 border-t border-border/40 flex items-center gap-3 text-[10px] text-muted-foreground",children:[s.duration_weeks&&e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(h,{className:"w-3 h-3",strokeWidth:1.5}),s.duration_weeks,"w"]}),s.capacity&&e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(j,{className:"w-3 h-3",strokeWidth:1.5}),s.enrolled_count||0,"/",s.capacity]}),e.jsx("span",{className:"ml-auto font-medium text-foreground text-xs",children:o})]}),i&&e.jsxs("div",{className:"flex items-center gap-1.5 text-[10px] text-green-600 mt-1",children:[e.jsx(N,{className:"w-3 h-3",strokeWidth:1.5}),"Enrolled"]})]})]})})}const w=[{id:"browse",label:"Browse"},{id:"my-labs",label:"My Labs"}];function F(){const[s,i]=d.useState(null),[r,a]=d.useState("browse");d.useEffect(()=>{c.auth.me().then(i).catch(()=>{})},[]);const{data:o=[],isLoading:n}=u({queryKey:["labs"],queryFn:()=>c.entities.Lab.list()}),{data:g=[]}=u({queryKey:["my-lab-enrolments",s==null?void 0:s.id],queryFn:()=>c.entities.LabEnrolment.filter({resident_id:s.id}),enabled:!!(s!=null&&s.id)}),x=o.filter(t=>t.status!=="draft"&&t.status!=="archived"),l=new Set(g.filter(t=>t.payment_status!=="pending").map(t=>t.lab_id)),b=x.filter(t=>l.has(t.id)),m=r==="browse"?x:b;return e.jsxs("div",{className:"min-h-screen bg-background",children:[e.jsxs("div",{className:"border-b border-border/60 px-6 lg:px-10 py-8",children:[e.jsx("p",{className:"text-xs text-muted-foreground tracking-widest uppercase mb-2 font-meta",children:"TRESDA Institute"}),e.jsx("h1",{className:"text-2xl font-semibold text-foreground mb-2",children:"Labs"}),e.jsx("p",{className:"text-sm text-muted-foreground max-w-lg leading-relaxed",children:"Live, project-based capability development. Build practical creative skills through guided experiences and real projects."})]}),e.jsx("div",{className:"border-b border-border/60 px-6 lg:px-10",children:e.jsx("div",{className:"flex gap-6",children:w.map(t=>e.jsxs("button",{onClick:()=>a(t.id),className:`py-3 text-xs font-medium border-b-2 transition-colors ${r===t.id?"border-foreground text-foreground":"border-transparent text-muted-foreground hover:text-foreground"}`,children:[t.label,t.id==="my-labs"&&l.size>0&&e.jsx("span",{className:"ml-1.5 text-[10px] bg-foreground text-background rounded-full px-1.5 py-0.5",children:l.size})]},t.id))})}),e.jsx("div",{className:"px-6 lg:px-10 py-8",children:n?e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4 max-w-6xl",children:[1,2,3].map(t=>e.jsx("div",{className:"h-72 bg-muted/50 animate-pulse"},t))}):m.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center py-24 text-center",children:[e.jsx(v,{className:"w-8 h-8 text-muted-foreground
1/30 mb-4",strokeWidth:1}),r==="browse"?e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"No Labs available yet."}),e.jsx("p",{className:"text-xs text-muted-foreground/60 mt-1",children:"New Labs are being prepared — check back soon."})]}):e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"You haven't enrolled in any Labs yet."}),e.jsx("button",{onClick:()=>a("browse"),className:"mt-3 text-xs text-foreground underline underline-offset-2",children:"Browse available Labs"})]})]}):e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4 max-w-6xl",children:m.map(t=>e.jsx(L,{lab:t,isEnrolled:l.has(t.id)},t.id))})})]})}export{F 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.