1import{r,j as e}from"./react-vendor-DDlTsOEd.js";import{g as j,d as f,k as d,B as m,s as N,ac as b,F as w}from"./index-dMYrr1t8.js";import{A as v}from"./AdminLayout-C0t6TWD9.js";import{S as a}from"./skeleton-DXQeB_cl.js";import{I as L}from"./image-CrlXsVPe.js";import{P as S}from"./play-MFKEhHAF.js";import"./megaphone-CG_Y22E9.js";import"./clipboard-check-H9MOfMyT.js";import"./database-BMcpOIuo.js";import"./tag-CsU2rQcC.js";import"./credit-card-CV_Lm4ZC.js";const T=[["path",{d:"M12 19v3",key:"npa21l"}],["path",{d:"M19 10v2a7 7 0 0 1-14 0v-2",key:"1vc78b"}],["rect",{x:"9",y:"2",width:"6",height:"13",rx:"3",key:"s6n7sd"}]],A=j("mic",T),x={video:e.jsx(S,{size:13,className:"text-red-500"}),pdf:e.jsx(w,{size:13,className:"text-blue-500"}),image:e.jsx(L,{size:13,className:"text-emerald-500"}),audio:e.jsx(A,{size:13,className:"text-purple-500"}),text:e.jsx(m,{size:13,className:"text-amber-500"})},C={video:"Video",pdf:"PDF",image:"Image",audio:"Audio",text:"Text"};function $(){const[c,p]=r.useState([]),[l,h]=r.useState(!0),[o,u]=r.useState(""),[n,g]=r.useState("");r.useEffect(()=>{f.get("/admin/lessons").then(s=>p(s.data??[])).finally(()=>h(!1))},[]);const y=Array.from(new Map(c.map(s=>[s.courseId,s.courseTitle])).entries()),i=c.filter(s=>{const t=o.toLowerCase();return(!t||s.title.toLowerCase().includes(t)||s.courseTitle.toLowerCase().includes(t))&&(!n||String(s.courseId)===n)});return e.jsx(v,{children:e.jsxs("div",{className:"space-y-5",children:[e.jsxs("div",{className:"flex items-center justify-between flex-wrap gap-3",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold text-gray-900",children:"Lessons"}),e.jsx("p",{className:"text-sm text-gray-900 mt-0.5",children:"All lessons across every course."})]}),e.jsx(d,{href:"/admin/courses",children:e.jsxs("button",{className:"flex items-center gap-2 bg-indigo-600 hover:bg-indigo-700 text-white text-sm font-medium px-4 py-2 rounded-lg transition-colors",children:[e.jsx(m,{size:15})," Go to Course Builder"]})})]}),e.jsxs("div",{className:"flex flex-wrap gap-3",children:[e.jsxs("div",{className:"relative flex-1 min-w-[200px]",children:[e.jsx(N,{size:15,className:"absolute left-3 top-1/2 -translate-y-1/2 text-gray-900"}),e.jsx("input",{value:o,onChange:s=>u(s.target.value),placeholder:"Search lessons...",className:"w-full pl-9 pr-4 py-2 border border-gray-200 rounded-lg text-sm focus:outline-none focus:ring-2 focus:ring-indigo-200"})]}),e.jsxs("select",{value:n,onChange:s=>g(s.target.value),className:"border border-gray-200 rounded-lg text-sm px-3 py-2 focus:outline-none focus:ring-2 focus:ring-indigo-200 bg-white",children:[e.jsx("option",{value:"",children:"All Courses"}),y.map(([s,t])=>e.jsx("option",{value:String(s),children:t},s))]})]}),e.jsxs("div",{className:"bg-white rounded-xl shadow-sm border border-gray-100 overflow-hidden",children:[e.jsx("div",{className:"px-5 py-3.5 border-b border-gray-100 flex items-center justify-between",children:e.jsx("span",{className:"text-sm font-semibold text-gray-900",children:l?"Loadingâ¦":`${i.length} lesson${i.length!==1?"s":""}`})}),e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"text-xs text-gray-900 uppercase tracking-wider border-b border-gray-50",children:[e.jsx("th",{className:"text-left px-5 py-3 font-medium",children:"#"}),e.jsx("th",{className:"text-left px-3 py-3 font-medium",children:"Title"}),e.jsx("th",{className:"text-left px-3 py-3 font-medium",children:"Course"}),e.jsx("th",{className:"text-left px-3 py-3 font-medium",children:"Type"}),e.jsx("th",{className:"text-left px-3 py-3 font-medium",children:"Order"}),e.jsx("th",{className:"text-left px-3 py-3 font-medium",children:"Added"}),e.jsx("th",{className:"px-3 py-3"})]})}),e.jsxs("tbody",{className:"divide-y divide-gray-50",children:[l?Array.from({length:6}).map((s,t)=>e.jsxs("tr",{children:[e.jsx("td",{className:"px-5 py-3",children:e.jsx(a,{className:"h-3 w-6 bg-gray-100"})}),e.jsx("td",{className:"px-3 py-3",children:e.jsx(a,{className:"h-3 w-40 bg-gray-100"})}),e.jsx("td",{className:"px-3 py-3",children:e.jsx(a,{className:"h-3 w-32 bg-gray-100"})}),e.jsx("td",{className:"px-3 py-3",children:e.jsx(a,{className:"h-5 w-16 rounded-full bg-gray-100"})}),e.jsx("td",{className:"px-3 py-3",children:e.jsx(a,{className:"h-3 w-8 bg-gray-100"})}),e.jsx("td",{className:"px-3 py-3",children:e.jsx(a,{className:"h-3 w-20 bg-gray-100"})}),e.jsx("td",{className:"px-3 py-3"})]},t)):i.map(s=>e.jsxs("tr",{className:"hover:bg-gray-50 transition-colors",children:[e.jsx("td",{className:"px-5 py-3 text-gray-900 text-xs",children:s.id}),e.jsx("td",{className:"px-3 py-3 font-medium text-gray-900 max-w-[220px] truncate",children:s.title}),e.jsx("td",{className:"px-3 py-3 text-gray-900 truncate max-w-[160px]",children:s.courseTitle}),e.jsx("td",{className:"px-3 py-3",children:e.jsxs("span",{className:"inline-flex items-center gap-1 bg-gray-100 px-2 py-0.5 rounded-full text-xs text-gray-900",children:[x[s.stepType]??x.text,C[s.stepType]??s.stepType]})}),e.jsx("td",{className:"px-3 py-3 text-gray-800 text-xs",children:s.lessonOrder}),e.jsx("td",{className:"px-3 py-3 text-gray-800 text-xs whitespace-nowrap",children:new Date(s.createdAt).toLocaleDateString("en-IN",{day:"numeric",month:"short",year:"2-digit"})}),e.jsx("td",{className:"px-3 py-3",children:e.jsx(d,{href:`/admin/courses/${s.courseId}/builder`,children:e.jsx("button",{className:"text-indigo-500 hover:text-indigo-700 transition-colors",title:"Edit in Course Builder",children:e.jsx(b,{size:14})})})})]},s.id)),!l&&i.length===0&&e.jsx("tr",{children:e.jsx("td",{colSpan:7,className:"px-5 py-12 text-center text-gray-900 text-sm",children:"No lessons foun
1d"})})]})]})})]})]})})}export{$ 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.