- apps/web: test updates (Vitest/setup), playbackAnalyticsService, TrackGrid, serviceErrorHandler - veza-common: logging, metrics, traits, validation, random - veza-stream-server: audio pipeline, codecs, cache, monitoring, routes - apps/web/dist_verification: refresh build assets (content-hashed filenames) Co-authored-by: Cursor <cursoragent@cursor.com>
1 line
12 KiB
JavaScript
1 line
12 KiB
JavaScript
import{a as l,j as e,R as F}from"./vendor-react-C9dYU-TK.js";import{S as g,C as M,B as Q,l as Y}from"./index-BMBS6scK.js";import{P as D}from"./progress-DFVonymQ.js";import{aF as U,N as B,c as z,aG as L,d as H,U as Z,aH as X,Q as T}from"./vendor-icons-BSV6HBy1.js";import{S as K}from"./input-DeoQfymd.js";import{m as E}from"./vendor-motion-CbAtAbUE.js";import"./vendor-CjLUfV8Y.js";import"./vendor-security-DsrNJhpn.js";import"./vendor-router-Dr0ZB7zf.js";import"./vendor-tanstack-C4XaEYj2.js";import"./vendor-http-CctT3C58.js";import"./vendor-utils-D0JLFg89.js";import"./vendor-i18n-PN7w4axr.js";function _(s,{threshold:n=0,root:a=null,rootMargin:t="0%",freezeOnceVisible:i=!1}){const[c,r]=l.useState(),o=c?.isIntersecting&&i;return l.useEffect(()=>{const p=s?.current;if(!!!window.IntersectionObserver||o||!p)return;const u={threshold:n,root:a,rootMargin:t},m=new IntersectionObserver(([A])=>{r(A)},u);return m.observe(p),()=>m.disconnect()},[s,n,a,t,o]),c}function q({blurDataURL:s,width:n,height:a,className:t=""}){return s?e.jsx("img",{src:s,alt:"",className:`blur-sm ${t}`,style:{width:n,height:a},"aria-hidden":"true"}):e.jsx(g,{className:t,style:{width:n,height:a}})}const P=["webp","avif","jpeg","png","gif"],J="jpeg";function ee(s,n){const a=s.replace(/\.[^/.]+$/,""),t=n??"100vw";return P.map(i=>({src:`${a}.${i}`,type:`image/${i}`,sizes:t}))}function se(){const[s,n]=l.useState([]);return l.useEffect(()=>{(async()=>{const t=[],i=await new Promise(r=>{const o=new Image;o.onload=o.onerror=()=>r(o.height===2),o.src="data:image/webp;base64,UklGRjoAAABXRUJQVlA4IC4AAACyAgCdASoCAAIALmk0mk0iIiIiIgBoSygABc6WWgAA/veff/0PP8bA//LwYAAA"}),c=await new Promise(r=>{const o=new Image;o.onload=o.onerror=()=>r(o.height===2),o.src="data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEAwgMgkAAAAAAAAG8AAAAA=="});i&&t.push("webp"),c&&t.push("avif"),t.push("jpeg","png","gif"),n(t)})()},[]),s}function te({src:s,alt:n,width:a,height:t,className:i="",placeholder:c,blurDataURL:r,priority:o=!1,quality:p=75,sizes:f="100vw",onLoad:u,onError:m,fallback:A}){const[d,j]=l.useState(!1),[b,v]=l.useState(!1),[G,R]=l.useState(null),V=l.useRef(null),N=se(),C=l.useRef(null),S=!!_(C,{threshold:.1,rootMargin:"50px"})?.isIntersecting,w=F.useMemo(()=>ee(s,f),[s,f]),I=l.useCallback(()=>{const x=N.find(y=>P.includes(y))||J;return w.find(y=>y.type===`image/${x}`)?.src||s},[N,w,s]),k=l.useCallback(()=>{if(d||b)return;const x=I();R(x);const h=new Image;h.onload=()=>{j(!0),u?.()},h.onerror=()=>{v(!0),m?.()},h.src=x},[d,b,I,u,m]);l.useEffect(()=>{(o||S)&&k()},[o,S,k]);const O=l.useCallback(()=>{v(!0),m?.()},[m]),W=l.useCallback(()=>{j(!0),u?.()},[u]);return b?A||e.jsx("div",{className:`bg-muted flex items-center justify-center ${i}`,style:{width:a,height:t},children:e.jsx("span",{className:"text-muted-foreground text-sm",children:"Image non disponible"})}):!d&&!o?e.jsxs("div",{ref:C,className:`relative ${i}`,style:{width:a,height:t},children:[e.jsx(q,{blurDataURL:r,width:a,height:t,className:"absolute inset-0"}),c&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:c})]}):e.jsxs("picture",{className:i,children:[w.map((x,h)=>e.jsx("source",{srcSet:x.src,type:x.type,sizes:x.sizes},`${x.type}-${h}`)),e.jsx("img",{ref:V,src:G||s,alt:n,width:a,height:t,className:`transition-opacity duration-[var(--sumi-duration-normal)] ${d?"opacity-100":"opacity-0"} ${i}`,onLoad:W,onError:O,loading:o?"eager":"lazy",decoding:"async",style:{width:a,height:t}})]})}function re(s){return!s.modules||s.modules.length===0?0:s.modules.reduce((n,a)=>n+(a.lessons?.length??0),0)}const ae=({course:s,onClick:n,showProgress:a=!1})=>{const t=re(s);return e.jsx("article",{children:e.jsxs(M,{variant:"default",className:"group p-0 overflow-hidden cursor-pointer hover:border-border/80 hover:shadow-xl transition-all duration-[var(--sumi-duration-normal)] flex flex-col h-full",onClick:()=>n(s),children:[e.jsxs("div",{className:"relative aspect-video bg-card overflow-hidden",children:[e.jsx(te,{src:s.thumbnailUrl,className:"w-full h-full object-cover opacity-90 group-hover:opacity-100 group-hover:scale-105 transition-all duration-[var(--sumi-duration-normal)]",alt:s.title}),e.jsx("div",{className:"absolute inset-0 bg-background/40 opacity-0 group-hover:opacity-100 transition-opacity flex items-center justify-center backdrop-blur-sm",children:e.jsx(U,{className:"w-12 h-12 text-foreground fill-current opacity-80"})}),s.certificateAvailable&&e.jsxs("div",{className:"absolute top-2 right-2 bg-warning/90 text-foreground text-xs font-bold px-2 py-0.5 rounded shadow-lg flex items-center gap-1",children:[e.jsx(B,{className:"w-3 h-3 fill-current"})," CERTIFIED"]}),e.jsxs("div",{className:"absolute bottom-2 left-2 bg-background/70 text-foreground text-xs px-2 py-1 rounded font-mono flex items-center gap-1 backdrop-blur-sm",children:[e.jsx(z,{className:"w-3 h-3"})," ",s.duration]}),t>0&&e.jsxs("div",{className:"absolute bottom-2 right-2 bg-background/70 text-foreground text-xs px-2 py-1 rounded font-mono flex items-center gap-1 backdrop-blur-sm",children:[e.jsx(L,{className:"w-3 h-3"})," ",t," lessons"]})]}),e.jsxs("div",{className:"p-4 flex flex-col flex-1",children:[e.jsxs("div",{className:"flex justify-between items-start mb-2",children:[e.jsx("span",{className:`text-xs px-2 py-0.5 rounded uppercase font-bold tracking-wide ${s.level==="Advanced"?"bg-destructive/20 text-destructive":s.level==="Intermediate"?"bg-warning/20 text-warning":"bg-success/20 text-success"}`,children:s.level}),s.rating&&e.jsxs("div",{className:"flex items-center gap-1 text-xs text-warning font-bold",children:[e.jsx(B,{className:"w-3 h-3 fill-current"})," ",s.rating]})]}),e.jsx("h3",{className:"font-bold text-foreground text-base mb-1 line-clamp-2 group-hover:text-foreground transition-colors",children:s.title}),e.jsxs("p",{className:"text-muted-foreground text-xs mb-3",children:["by ",s.instructor]}),e.jsx("div",{className:"mt-auto pt-2",children:a&&s.progress!==void 0?e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground",children:[e.jsx("span",{children:"Progress"}),e.jsxs("span",{className:s.progress===100?"text-success":"text-foreground",children:[s.progress,"%"]})]}),e.jsx(D,{value:s.progress,color:s.progress===100?"lime":"cyan"}),s.progress===100&&e.jsxs("div",{className:"flex items-center gap-1 text-xs text-success mt-1 font-bold",children:[e.jsx(H,{className:"w-3 h-3"})," Completed"]})]}):e.jsxs("div",{className:"flex justify-between items-center border-t border-foreground/5 pt-3",children:[e.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[e.jsx(Z,{className:"w-3 h-3"})," ",(s.studentCount||0).toLocaleString()," students"]}),e.jsx("span",{className:"font-mono font-bold text-foreground",children:s.price&&s.price>0?`$${s.price}`:"Free"})]})})]}),a&&s.progress!==void 0&&s.progress<100&&e.jsx("div",{className:"h-1 w-full bg-muted",children:e.jsx("div",{className:"h-full bg-primary transition-all duration-500",style:{width:`${s.progress}%`}})})]})})},$=F.memo(ae);$.displayName="CourseCard";function ne({onMyCoursesClick:s}){return e.jsxs("div",{className:"flex flex-col md:flex-row justify-between items-end border-b border-border pb-6 gap-4",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-heading font-bold text-foreground mb-2 tracking-tight",children:"ACADEMY"}),e.jsx("p",{className:"text-muted-foreground font-mono text-sm",children:"Level up your skills. Earn certificates."})]}),e.jsx(Q,{variant:"glass",icon:e.jsx(X,{className:"w-4 h-4"}),onClick:s,children:"MY LEARNING"})]})}function oe({className:s}){return e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:s,children:[e.jsx("line",{x1:"12",x2:"12",y1:"2",y2:"22"}),e.jsx("path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6"})]})}function le({search:s,onSearchChange:n,filterLevel:a,onFilterLevelChange:t,filterPrice:i,onFilterPriceChange:c}){return e.jsxs("div",{className:"flex flex-col md:flex-row gap-4 items-center bg-card/50 p-4 rounded-xl border border-border",children:[e.jsx("div",{className:"w-full md:w-96",children:e.jsx(K,{placeholder:"Search for courses, skills, or teachers...",value:s,onChange:r=>n(r.target.value)})}),e.jsxs("div",{className:"flex flex-wrap gap-2 w-full md:w-auto",children:[e.jsxs("div",{className:"flex items-center gap-1.5 bg-muted rounded-lg p-1 border border-border",children:[e.jsx(T,{className:"w-4 h-4 text-muted-foreground ml-2"}),["All","Beginner","Intermediate","Advanced"].map(r=>e.jsx("button",{type:"button",onClick:()=>t(r),className:`px-3 py-1.5 rounded-md text-xs font-bold uppercase transition-all ${a===r?r==="Advanced"?"bg-destructive/20 text-destructive shadow-sm":r==="Intermediate"?"bg-warning/20 text-warning shadow-sm":r==="Beginner"?"bg-success/20 text-success shadow-sm":"bg-primary/20 text-primary shadow-sm":"text-muted-foreground hover:text-foreground hover:bg-foreground/5"}`,children:r==="All"?"All Levels":r},r))]}),e.jsxs("div",{className:"flex items-center gap-1.5 bg-muted rounded-lg p-1 border border-border",children:[e.jsx(oe,{className:"w-4 h-4 text-muted-foreground ml-2"}),["All","Free","Paid"].map(r=>e.jsx("button",{type:"button",onClick:()=>c(r),className:`px-3 py-1.5 rounded-md text-xs font-bold uppercase transition-all ${i===r?"bg-primary/20 text-primary shadow-sm":"text-muted-foreground hover:text-foreground hover:bg-foreground/5"}`,children:r==="All"?"All Prices":r},r))]})]})]})}function ie(){return e.jsxs("div",{className:"col-span-full text-center py-24 text-muted-foreground",children:[e.jsx(L,{className:"w-12 h-12 mx-auto mb-4 opacity-50"}),e.jsx("p",{children:"No courses found matching your criteria."})]})}function ce(){return e.jsxs("div",{className:"space-y-8 animate-fadeIn pb-20 min-h-layout-page",children:[e.jsxs("div",{className:"flex flex-col md:flex-row justify-between items-end border-b border-border pb-6 gap-4",children:[e.jsxs("div",{children:[e.jsx(g,{className:"h-8 w-32 mb-2"}),e.jsx(g,{className:"h-4 w-64"})]}),e.jsx(g,{className:"h-11 w-40 rounded-lg"})]}),e.jsxs("div",{className:"flex flex-col md:flex-row gap-4 items-center bg-card/50 p-4 rounded-xl border border-border",children:[e.jsx(g,{className:"h-10 w-full md:w-96 rounded-lg"}),e.jsxs("div",{className:"flex gap-2 w-full md:w-auto",children:[e.jsx(g,{className:"h-9 w-28 rounded-lg"}),e.jsx(g,{className:"h-9 w-24 rounded-lg"})]})]}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-8",children:[1,2,3,4,5,6].map(s=>e.jsx(g,{className:"aspect-video w-full rounded-xl"},s))})]})}const de={async getCatalog(){return[]}};function ue(s){const[n,a]=l.useState(""),[t,i]=l.useState("All"),[c,r]=l.useState("All"),[o,p]=l.useState(s??[]),[f,u]=l.useState(s===void 0);l.useEffect(()=>{if(s!==void 0)return;(async()=>{u(!0);try{const d=await de.getCatalog();p(d)}catch(d){Y.error("Failed to load courses",{error:d instanceof Error?d.message:String(d),stack:d instanceof Error?d.stack:void 0})}finally{u(!1)}})()},[s]);const m=o.filter(A=>{const d=A.title.toLowerCase().includes(n.toLowerCase())||(A.tags??[]).some(v=>v.toLowerCase().includes(n.toLowerCase())),j=t==="All"||A.level===t,b=c==="All"||(c==="Free"?A.price===0:(A.price??0)>0);return d&&j&&b});return{search:n,setSearch:a,filterLevel:t,setFilterLevel:i,filterPrice:c,setFilterPrice:r,courses:o,loading:f,filtered:m}}const me={visible:{transition:{staggerChildren:.06,delayChildren:.04}}},Ae={hidden:{opacity:0,y:16,scale:.97},visible:{opacity:1,y:0,scale:1,transition:{duration:.35,ease:[.33,1,.68,1]}}};function ke({onCourseClick:s,onMyCoursesClick:n,initialCourses:a}){const{search:t,setSearch:i,filterLevel:c,setFilterLevel:r,filterPrice:o,setFilterPrice:p,loading:f,filtered:u}=ue(a);return f?e.jsx(ce,{}):e.jsxs("div",{className:"space-y-8 animate-fadeIn pb-20 min-h-layout-page",children:[e.jsx(ne,{onMyCoursesClick:n}),e.jsx(le,{search:t,onSearchChange:i,filterLevel:c,onFilterLevelChange:r,filterPrice:o,onFilterPriceChange:p}),u.length===0?e.jsx(ie,{}):e.jsx(E.div,{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-8",variants:me,initial:"hidden",animate:"visible",children:u.map(m=>e.jsx(E.div,{variants:Ae,children:e.jsx($,{course:m,onClick:A=>s?.(A)})},m.id))})]})}export{ke as EducationView};
|