PageSourceSearch

https://www.engineeringskills.com/_next/static/chunks/pages/admin/video-2877d94ac56448d4.js

js engineeringskills.com collected 2026-10-04 12:48:07 UTC 17,702 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8761],{65550:function(e,a,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/admin/video",function(){return t(60107)}])},20449:function(e,a,t){"use strict";t.d(a,{Z:function(){return m}});var n=t(85893),s=t(67294),i=t(41664),r=t.n(i),o=t(11163);let d=[{label:"Overview",links:[{name:"Home",href:"/courses"},{name:"Dashboard",href:"/admin"},{name:"Membership",href:"/admin/membership"},{name:"Traffic",href:"/admin/traffic/dashboard"}]},{label:"Transactions",links:[{name:"Transactions",href:"/admin/transactions"},{name:"Downloads",href:"/admin/downloads"}]},{label:"Access",links:[{name:"All Records",href:"/admin/access-show"},{name:"New Record",href:"/admin/access-new"},{name:"Update Access",href:"/admin/access-update"},{name:"Student Access",href:"/admin/student-access"},{name:"Temp Users",href:"/admin/temp-users-show"}]},{label:"Content",links:[{name:"Add/Update Assets",href:"/admin/assets"},{name:"Video Assets",href:"/admin/video"}]}],l=()=>{let e=(0,o.useRouter)(),[a,t]=(0,s.useState)(!1),i=async()=>{let e=await fetch("/api/algolia",{method:"POST",headers:{"Content-Type":"application/json"}}),a=await e.json();console.log(a)},l=async()=>{let e=await fetch("/api/cron/send-daily-report",{method:"POST",headers:{"Content-Type":"application/json"}}),a=await e.json();console.log(a)},c=a=>e.pathname===a,m=(0,n.jsxs)("div",{className:"flex flex-col h-full",children:[(0,n.jsx)("div",{className:"px-6 py-5 border-b border-admin-border",children:(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)("span",{className:"inline-block w-2 h-2 rounded-full bg-admin-accent"}),(0,n.jsx)("h2",{className:"text-lg font-semibold text-admin-text",children:"Admin"})]})}),(0,n.jsx)("nav",{className:"flex-1 overflow-y-auto px-3 py-4 space-y-7",children:d.map(e=>(0,n.jsxs)("div",{children:[(0,n.jsx)("p",{className:"px-3 mb-2 text-[11px] font-medium uppercase tracking-wider text-admin-subtle",children:e.label}),(0,n.jsx)("ul",{className:"space-y-1",children:e.links.map(e=>(0,n.jsx)("li",{children:(0,n.jsx)(r(),{href:e.href,onClick:()=>t(!1),className:"block rounded-md text-[13px] transition-colors ".concat(c(e.href)?"bg-admin-surface text-admin-text border-l-2 border-admin-accent pl-2.5 pr-3 py-2":"text-admin-muted hover:text-admin-text hover:bg-admin-surface px-3 py-2"),children:e.name})},e.href))})]},e.label))}),(0,n.jsxs)("div",{className:"px-3 py-4 border-t border-admin-border space-y-2",children:[(0,n.jsx)("button",{onClick:i,className:"w-full px-3 py-2 text-sm rounded-md border border-admin-border text-admin-muted hover:text-admin-text hover:border-admin-border-strong bg-transparent transition-colors",children:"Update Algolia Index"}),(0,n.jsx)("button",{onClick:l,className:"w-full px-3 py-2 text-sm rounded-md border border-admin-border text-admin-muted hover:text-admin-text hover:border-admin-border-strong bg-transparent transition-colors",children:"Email Report"})]})]});return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("button",{onClick:()=>t(!0),className:"lg:hidden fixed top-4 left-4 z-50 p-2 rounded-md bg-admin-surface text-admin-muted hover:text-admin-text","aria-label":"Open sidebar",children:(0,n.jsx)("svg",{className:"w-6 h-6",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 6h16M4 12h16M4 18h16"})})}),a&&(0,n.jsx)("div",{className:"lg:hidden fixed inset-0 z-40 bg-black/50",onClick:()=>t(!1)}),(0,n.jsxs)("aside",{className:"lg:hidden fixed inset-y-0 left-0 z-50 w-64 bg-admin-bg border-r border-admin-border transform transition-transform duration-200 ".concat(a?"translate-x-0":"-translate-x-full"),children:[(0,n.jsx)("button",{onClick:()=>t(!1),className:"absolute top-4 right-4 p-1 text-admin-muted hover:text-admin-text","aria-label":"Close sidebar",children:(0,n.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})}),m]}),(0,n.jsx)("aside",{className:"hidden lg:block w-64 flex-shrink-0 bg-admin-bg border-r border-admin-border",children:m})]})},c=e=>{let{children:a}=e;return(0,n.jsxs)("div",{className:"flex h-screen bg-admin-bg font-admin-sans antialiased",children:[(0,n.jsx)(l,{}),(0,n.jsx)("main",{className:"flex-1 overflow-y-auto",children:(0,n.jsx)("div",{className:"p-6 lg:p-8",children:a})})]})};var m=c},25581:function(e,a,t){"use strict";t.d(a,{Z:function(){return r}});var n=t(85893),s=t(67294),i=t(78118);function r(e){let{playbackID:a,thumbnailTime:t,videoTitle:r,preview:o,autoPlay:d,poster:l,muted:c,loop:m}
1=e,[u,x]=(0,s.useState)(null);return(0,s.useEffect)(()=>{x(null);let e=async()=>{let e=await fetch("/api/mux-token",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({playbackID:a,thumbnailTime:t,preview:o})}),n=await e.json();x(n)};e()},[a,t,o]),(0,n.jsx)("div",{className:"rounded-lg",children:u?(0,n.jsx)(i.ZP,{playbackRates:[.5,.75,1,1.25,1.5,1.75,2],autoPlay:d,streamType:"on-demand",defaultHiddenCaptions:!0,playbackId:a,metadata:{video_id:a,video_title:r,viewer_user_id:"user-id-007"},poster:l||null,muted:!!c&&c,loop:!!m&&m,thumbnailTime:t,primaryColor:"#fff",secondaryColor:"#16244880",accentColor:"#3FFCD9",title:r,style:{aspectRatio:16/9,borderRadius:"1rem 1rem 1rem 1rem",overflow:"hidden"},tokens:{playback:u&&u.playbackToken,thumbnail:u&&u.thumbnailToken,storyboard:u&&u.storyboardToken}}):(0,n.jsx)(i.ZP,{playbackRates:[.5,.75,1,1.25,1.5,1.75,2],streamType:"on-demand",primaryColor:"#bfdbfe",secondaryColor:"#162448",accentColor:"#3FFCD9",playbackId:"",style:{aspectRatio:16/9}})})}},60107:function(e,a,t){"use strict";t.r(a),t.d(a,{__N_SSP:function(){return g},default:function(){return y}});var n=t(85893),s=t(67294),i=t(20449),r=t(25675),o=t.n(r),d=t(41664),l=t.n(d),c=t(47489),m=t(30488),u=t(44080),x=t(6245),h=t(25581),p=t(89583);function b(e){let{id:a}=e.video,{onDelete:t}=e,[i,r]=(0,s.useState)(null),[d,m]=(0,s.useState)(null),[b,f]=(0,s.useState)(null),[v,j]=(0,s.useState)(null),[g,y]=(0,s.useState)(null),[N,w]=(0,s.useState)(!1),[k,C]=(0,s.useState)(!1),T=e.video.playback_ids[0].id,S=e.video.id;(0,s.useEffect)(()=>{let e=async()=>{let e=await fetch("/api/mux-token",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({playbackID:T,thumbnailTime:1,preview:!1})}),a=await e.json();r("https://image.mux.com/".concat(T,"/thumbnail.png?time=").concat(1,"&token=").concat(a.thumbnailToken))};e();let t=c.Z.courseList.flatMap(e=>e.lessons.map(a=>({lesson:a,courseTitle:e.title,courseID:e.courseId,infoPageSlug:e.infoPageSlug}))).find(e=>e.lesson.muxAssetId==a);t&&m(t.lesson),t&&f(t.courseTitle),t&&j(t.courseID),t&&y(t.infoPageSlug)},[T]);let P=()=>{w(!0)},F=async()=>{await fetch("/api/mux-delete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({muxAssetId:S})}),C(!1),t(S)};return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(u.u.Root,{show:k,as:s.Fragment,children:(0,n.jsxs)(x.V,{onClose:()=>C(!1),className:"relative z-50",children:[(0,n.jsx)(u.u.Child,{enter:"ease-out duration-300",enterFrom:"opacity-0",enterTo:"opacity-100",leave:"ease-in duration-200",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:(0,n.jsx)("div",{className:"fixed inset-0 bg-gray-900/50 ","aria-hidden":"true"})}),(0,n.jsx)("div",{className:"fixed inset-0 flex flex-col items-center justify-center",children:(0,n.jsx)(u.u.Child,{enter:"ease-out duration-300",enterFrom:"opacity-0 scale-95",enterTo:"opacity-100 scale-100",leave:"ease-in duration-200",leaveFrom:"opacity-100 scale-100",leaveTo:"opacity-0 scale-95",children:(0,n.jsx)(x.V.Panel,{className:"w-full max-w-3xl white-glow",children:(0,n.jsxs)("div",{className:"bg-admin-surface p-4 rounded-md shadow-lg max-w-md mx-auto mt-8 border border-admin-border",children:[(0,n.jsx)("h2",{className:"text-lg font-semibold mb-4 text-admin-text",children:"Delete Video"}),(0,n.jsx)("p",{className:"text-admin-muted mb-6",children:"Are you sure you want to delete this video? This action cannot be undone."}),(0,n.jsxs)("div",{className:"flex justify-end space-x-4",children:[(0,n.jsx)("button",{onClick:()=>C(!1),className:"relative inline-flex items-center rounded-md border border-transparent px-4 py-2 shadow-sm focus:outline-none mt-12 bg-admin-overlay text-admin-muted hover:bg-admin-border-strong",children:"Cancel"}),(0,n.jsxs)("button",{onClick:F,className:"relative inline-flex items-center rounded-md border border-transparent bg-red-500 px-4 py-2 text-white shadow-sm hover:bg-red-600 focus:outline-none mt-12",children:[(0,n.jsx)(p.AMf,{className:"mr-2"})," Delete"]})]})]})})})})]})}),(0,n.jsx)(u.u.Root,{show:N,as:s.Fragment,children:(0,n.jsxs)(x.V,{onClose:()=>w(!1),className:"relative z-50",children:[(0,n.jsx)(u.u.Child,{enter:"ease-out duration-300",enterFrom:"opacity-0",enterTo:"opacity-100",leave:"ease-in duration-200",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:(0,n.jsx)("div",{className:"fixed inset-0 bg-gray-900/50 ","aria-hidden":"true"})}),(0,n.jsx)("div",{className:"fixed inset-0 flex flex-col items-center justify-center",children:(0,n.jsx)(u.u.Child,{enter:"ease-out duration-300",enterFrom:"opacity-0 scale-95",enterTo:"opacity-100 scale-100",leave:"ease-in duration-200",leaveFrom:"opacity-100 scale-100",leaveTo:"opacity-0 scale-95",children:(0,n.jsx)(x.V.Panel,{className:"w-full max-w-3xl white-glow",children:(0,n.jsx)("div",{className:"rounded-lg overflow-hidden",children:(0,n.jsx)(h.Z,{playbackID:T,thumbnailTime:1,videoTitle:i&&d&&d.title,preview:!0,autoPlay:!0})})})})})]})}),(0,n.jsx)("div",{className:"relative",children:i&&(0,n.jsx)("div",{children:i&&(0,n.jsxs)("div",{className:"flex items-center border border-admin-border p-2 shadow-md rounded-md bg-admin-surface",children:[(0,n.jsx)(l(),{href:"/course/".concat(g,"/").concat(d&&d.slug),className:"mr-4",children:(0,n.jsx)(o(),{src:i,alt:"Video thumbnail",width:"300",height:"25",className:" shadow rounded"})}),(0,n.jsxs)("div",{className:"flex flex-col justify-between flex-grow",children:[(0,n.jsxs)("div",{children:[(0,n.jsxs)("h3",{className:"font-bold",children:["Video Asset Id: ",S]}),(0,n.jsxs)("h3",{className:"text-sm text-admin-muted mb-2",children:["Video Playback Id: ",T]}),(0,n.jsxs)("h3",{className:" font-bold",children:["Course: ",b]}),(0,n.jsxs)("h3",{className:"text-sm text-admin-muted mb-2",children:["Course ID: ",v]}),(0,n.jsxs)("h3",{className:" font-bold",children:["Lesson: ",d&&d.title]}),(0,n.jsxs)("h3",{className:"text-sm text-admin-muted mb-2",children:["Lesson ID: ",d&&d.uniqueLessonId]})]}),(0,n.jsxs)("span",{className:"text-sm font-bold",children:["Duration: ",(e=>{let a=Math.floor(e/3600),t=Math.floor(e%3600/60),n=Math.round(e%60);return a?"".concat(String(a).padStart(2,"0"),":").concat(String(t).padStart(2,"0"),":").concat(String(n).padStart(2,"0")):"".concat(String(t).padStart(2,"0"),":").concat(String(n).padStart(2,"0"))})(e.video.duration)]})]}),(0,n.jsxs)("div",{className:"absolute bottom-2 right-2 space-x-2",children:[" ",(0,n.jsxs)("button",{onClick:P,className:"relative inline-flex items-center rounded-md border border-transparent bg-admin-accent px-4 py-2 text-admin-bg shadow-sm hover:bg-admin-accent-hover focus:outline-none mt-12",children:[(0,n.jsx)(p.gmG,{className:"mr-2"})," Play "]}),(0,n.jsxs)("button",{onClick:()=>C(!0),className:"relative inline-flex items-center rounded-md border border-transparent bg-red-500 px-4 py-2 text-white shadow-sm hover:bg-red-600 focus:outline-none mt-12",children:[(0,n.jsx)(p.AMf,{className:"mr-2"})," Delete"]})]})]})})})]})}c.Z.courseList=c.Z.courseList.concat(m.Z.courseList);var f=t(59213);
1function v(e){let[a,t]=(0,s.useState)(null);return(0,s.useEffect)(()=>{let e=async()=>{let e=await fetch("/api/mux-upload-url",{method:"GET",headers:{"Content-Type":"application/json"}}),a=await e.json();t(a.uploadURL)};e()},[]),(0,n.jsx)("div",{className:"bg-white text-gray-800",children:(0,n.jsx)(f.ZP,{endpoint:a,onSuccess:()=>e.onUploadComplete()})})}let j=e=>{var a;let[t,i]=(0,s.useState)((null===(a=e.videos)||void 0===a?void 0:a.data)||[]),[r,o]=(0,s.useState)(1),[d,l]=(0,s.useState)(10),[c,m]=(0,s.useState)(""),[h,f]=(0,s.useState)(!1),j=async()=>{let e=await fetch("/api/mux-fetch-videos",{method:"GET",headers:{"Content-Type":"application/json"}}),a=await e.json();i(null==a?void 0:a.videos)},g=e=>{let a=t.filter(a=>a.id!==e);i(a)},y=async()=>{let e=await fetch("/api/video/bulk-upload",{method:"GET",headers:{"Content-Type":"application/json"}}),a=await e.json();console.log("videos:"),console.log(a)},N=async()=>{let e=await fetch("/api/utils/generate-lesson-mdx",{method:"GET",headers:{"Content-Type":"application/json"}}),a=await e.json();console.log(a)},w=c?t.filter(e=>e.id.includes(c)):t,k=w.slice((r-1)*d,r*d);return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(u.u.Root,{show:h,as:s.Fragment,children:(0,n.jsxs)(x.V,{onClose:()=>f(!1),className:"relative z-50",children:[(0,n.jsx)(u.u.Child,{enter:"ease-out duration-300",enterFrom:"opacity-0",enterTo:"opacity-100",leave:"ease-in duration-200",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:(0,n.jsx)("div",{className:"fixed inset-0 bg-gray-900/50 ","aria-hidden":"true"})}),(0,n.jsx)("div",{className:"fixed inset-0 flex flex-col items-center justify-center",children:(0,n.jsx)(u.u.Child,{enter:"ease-out duration-300",enterFrom:"opacity-0 scale-95",enterTo:"opacity-100 scale-100",leave:"ease-in duration-200",leaveFrom:"opacity-100 scale-100",leaveTo:"opacity-0 scale-95",children:(0,n.jsx)(x.V.Panel,{className:"w-full max-w-3xl white-glow",children:(0,n.jsx)("div",{children:(0,n.jsx)(v,{onUploadComplete:()=>j()})})})})})]})}),(0,n.jsx)("div",{className:"text-admin-text",children:(0,n.jsx)("div",{className:"relative mx-auto max-w-7xl",children:(0,n.jsxs)("div",{className:"mt-6",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("h1",{className:"text-4xl font-bold",children:"Video Assets"}),(0,n.jsxs)("p",{className:"mb-6",children:[t.length," videos"]})]}),(0,n.jsx)("div",{className:"flex justify-end",children:(0,n.jsxs)("button",{onClick:()=>f(!0),className:"relative inline-flex items-center rounded-md bg-admin-accent px-4 py-2 font-medium text-admin-bg hover:bg-admin-accent-hover focus:outline-none mt-12 transition-colors",children:[(0,n.jsx)(p.Qvc,{className:"mr-2 w-8"})," Upload Video"]})}),(0,n.jsxs)("div",{className:"flex mb-4",children:[(0,n.jsx)("label",{htmlFor:"searchVideo",className:"mr-2",children:"Search by Video ID:"}),(0,n.jsx)("input",{id:"searchVideo",type:"text",value:c,onChange:e=>m(e.target.value),placeholder:"Enter Video ID",className:"border border-admin-border px-2 py-1.5 rounded-md bg-admin-overlay text-admin-text w-64 text-sm focus:border-admin-accent focus:ring-1 focus:ring-admin-accent focus:outline-none transition-colors"})]}),(0,n.jsx)("table",{className:"min-w-full",children:(0,n.jsx)("tbody",{className:"divide-y divide-admin-border",children:k.map((e,a)=>(0,n.jsx)("tr",{children:(0,n.jsx)("td",{className:"px-6 py-4 whitespace-nowrap",children:(0,n.jsx)(b,{video:e,onDelete:g})})},a))})}),(0,n.jsxs)("div",{className:"mt-4 mb-10 flex justify-end",children:[(0,n.jsx)("label",{htmlFor:"rowsPerPage",className:"mr-2",children:"Rows per page:"}),(0,n.jsxs)("select",{id:"rowsPerPage",value:d,onChange:e=>{l(parseInt(e.target.value)),o(1)},className:"border border-admin-border px-2 py-1.5 rounded-md bg-admin-overlay text-admin-text text-sm w-16 min-w-16 focus:border-admin-accent focus:ring-1 focus:ring-admin-accent focus:outline-none",children:[(0,n.jsx)("option",{value:10,children:"10"}),(0,n.jsx)("option",{value:15,children:"15"}),(0,n.jsx)("option",{value:50,children:"50"})]}),(0,n.jsx)("button",{onClick:()=>o(1),disabled:1===r,className:"border border-admin-border px-3 py-1.5 text-sm rounded-l-md bg-transparent text-admin-muted hover:text-admin-text hover:bg-admin-surface transition-colors disabled:opacity-40",children:"First"}),(0,n.jsx)("button",{onClick:()=>o(r-1),disabled:1===r,className:"border border-admin-border px-3 py-1.5 text-sm bg-transparent text-admin-muted hover:text-admin-text hover:bg-admin-surface transition-colors disabled:opacity-40",children:"Previous"}),(0,n.jsx)("button",{onClick:()=>o(r+1),disabled:r===Math.ceil(t.length/d),className:"border border-admin-border px-3 py-1.5 text-sm bg-transparent text-admin-muted hover:text-admin-text hover:bg-admin-surface transition-colors disabled:opacity-40",children:"Next"}),(0,n.jsx)("button",{onClick:()=>o(Math.ceil(t.length/d)),disabled:r===Math.ceil(t.length/d),className:"border border-admin-border px-3 py-1.5 text-sm rounded-r-md bg-transparent text-admin-muted hover:text-admin-text hover:bg-admin-surface transition-colors disabled:opacity-40",children:"Last"})]}),(0,n.jsxs)("div",{className:"flex justify-end",children:[(0,n.jsxs)("button",{onClick:()=>y(!0),className:"relative inline-flex items-center rounded-md bg-admin-accent px-4 py-2 font-medium text-admin-bg hover:bg-admin-accent-hover focus:outline-none mt-12 transition-colors",children:[(0,n.jsx)(p.Qvc,{className:"mr-2 w-8"})," Trigger Bulk Upload from AWS"]}
1),(0,n.jsxs)("button",{onClick:()=>N(!0),className:"relative inline-flex items-center rounded-md bg-admin-accent px-4 py-2 ml-4 font-medium text-admin-bg hover:bg-admin-accent-hover focus:outline-none mt-12 transition-colors",children:[(0,n.jsx)(p.OxQ,{className:"mr-2 w-8"})," Generate Lesson MDX files"]})]})]})})})]})};var g=!0,y=j;j.getLayout=function(e){return(0,n.jsx)(i.Z,{children:e})}}},function(e){e.O(0,[9412,8118,9213,7489,488,9774,2888,179],function(){return e(e.s=65550)}),_N_E=e.O()}]);

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.