PageSourceSearch

https://login.villatracker.com/static/js/3058.3bb6981e.chunk.js

js villatracker.com collected 2026-10-08 03:49:16 UTC 8,830 bytes, 2 lines download raw bytes

1"use strict";(self.webpackChunkvillatrackerfrontend=self.webpackChunkvillatrackerfrontend||[]).push([[3058],{15593:function(e,a,i){i.d(a,{A:function(){return n}});i(65043),i(68695);var t=i(70579);var n=e=>{const{visible:a}=e;return a?(0,t.jsx)("div",{className:"spinner"}):null}},17490:function(e,a,i){i.d(a,{$3:function(){return r},$M:function(){return c},Bl:function(){return s},MH:function(){return o},aN:function(){return h},j3:function(){return p},jE:function(){return d},jk:function(){return m},rS:function(){return u}});var t=i(86213),n=i(88862);const l=(e={})=>t.A.create({baseURL:n.V,headers:{Authorization:`Bearer ${localStorage.getItem("jToken")}`,...e}}),s=(e={})=>{const a=new URLSearchParams;return Object.entries(e).forEach(([e,i])=>{void 0!==i&&null!==i&&""!==i&&a.set(e,String(i))}),l().get(`/media/list?${a.toString()}`)},d=()=>l().get("/media/categories"),r=e=>l().post(`/media/track-view/${e}`),o=e=>l().post(`/media/track-download/${e}`),c=(e,a)=>l({"Content-Type":"multipart/form-data"}).post("/media/admin/upload",e,{onUploadProgress:a}),u=(e,a)=>l().put(`/media/admin/${e}`,a),m=e=>l().post(`/media/admin/${e}/publish`),h=e=>l().post(`/media/admin/${e}/unpublish`),p=e=>l().delete(`/media/admin/${e}`)},63058:function(e,a,i){i.r(a),i.d(a,{default:function(){return o}});var t=i(65043),n=i(73023),l=i.n(n),s=i(17490),d=i(15593),r=i(70579);var o=()=>{const[e,a]=(0,t.useState)([]),[i,n]=(0,t.useState)([]),[o,c]=(0,t.useState)(!0),[u,m]=(0,t.useState)({title:"",description:"",category:"",tags:"",displayOrder:0,duration:0}),[h,p]=(0,t.useState)(null),[v,g]=(0,t.useState)(null),[b,j]=(0,t.useState)(!1),[x,y]=(0,t.useState)(0),f=async()=>{try{const{data:e}=await(0,s.Bl)({includeUnpublished:!0,limit:100});n((null===e||void 0===e?void 0:e.mediaAssets)||[])}catch(i){var e,a;console.error(i),l()("Failed to load media list",(null===i||void 0===i||null===(e=i.response)||void 0===e||null===(a=e.data)||void 0===a?void 0:a.message)||i.message,"error")}};(0,t.useEffect)(()=>{let e=!1;return(async()=>{c(!0);try{const[{data:i}]=await Promise.all([(0,s.jE)(),f()]);if(!e){const e=(null===i||void 0===i?void 0:i.categories)||[];a(e),m(a=>{var i;return{...a,category:a.category||(null===(i=e[0])||void 0===i?void 0:i.slug)||""}})}}catch(i){e||console.error("Admin load error:",i)}finally{e||c(!1)}})(),()=>{e=!0}},[]);const w=(e,a)=>m(i=>({...i,[e]:a}));return(0,r.jsxs)("div",{className:"media-admin",children:[(0,r.jsxs)("header",{className:"media-admin-header",children:[(0,r.jsx)("h1",{children:"Media Directory - Admin"}),(0,r.jsx)("p",{children:"Upload, edit, publish, and remove curated marketing videos."})]}),(0,r.jsxs)("section",{className:"media-admin-upload",children:[(0,r.jsx)("h2",{children:"Upload new media"}),(0,r.jsxs)("form",{onSubmit:async e=>{e.preventDefault();const a=u.title.trim()?u.category?h?v?"video/mp4"!==h.type?"Video must be MP4 (H.264 recommended)":h.size>524288e3?"Video exceeds 500 MB":["image/jpeg","image/png","image/webp"].includes(v.type)?v.size>10485760?"Thumbnail exceeds 10 MB":null:"Thumbnail must be JPEG, PNG, or WebP":"Thumbnail image is required":"Video file is required":"Category is required":"Title is required";if(a)return void l()("Check the form",a,"warning");const i=new FormData;i.append("title",u.title.trim()),i.append("description",u.description.trim()),i.append("category",u.category),i.append("tags",u.tags),i.append("displayOrder",u.displayOrder||0),i.append("duration",u.duration||0),i.append("video",h),i.append("thumbnail",v),j(!0),y(0);try{await(0,s.$M)(i,e=>{e.total&&y(Math.round(e.loaded/e.total*100))}),l()("Uploaded",`${u.title} is now live.`,"success"),m({title:"",description:"",category:u.category,tags:"",displayOrder:0,duration:0}),p(null),g(null),document.querySelectorAll('input[type="file"]').forEach(e=>{e.value=""}),await f()}catch(a){var t,n;console.error(a),l()("Upload failed",(null===a||void 0===a||null===(t=a.response)||void 0===t||null===(n=t.data)||void 0===n?void 0:n.message)||a.message,"error")}finally{j(!1),y(0)}},className:"media-admin-form",children:[(0,r.jsxs)("label",{children:["Title *",(0,r.jsx)("input",{type:"text",value:u.title,onChange:e=>w("title",e.target.value),required:!0,disabled:b})]}),(0,r.jsxs)("label",{children:["Category *",(0,r.jsx)("select",{value:u.category,onChange:e=>w("category",e.target.value),required:!0,disabled:b,children:e.map(e=>(0,r.jsx)("option",{value:e.slug,children:e.label},e.slug))})]}),(0,r.jsxs)("label",{className:"media-admin-form-full",children:["Description",(0,r.jsx)("textarea",{rows:3,value:u.description,onChange:e=>w("description",e.target.value),disabled:b})]}),(0,r.jsxs)("label",{children:["Tags (comma-separated)",(0,r.jsx)("input",{type:"text",value:u.tags,onChange:e=>w("tags",e.target.value),placeholder:"e.g. coast, mediterranean",disabled:b})]}),(0,r.jsxs)("label",{children:["Display order",(0,r.jsx)("input",{type:"number",value:u.displayOrder,onChange:e=>w("displayOrder",e.target.value),min:0,disabled:b})]}),(0,r.jsxs)("label",{children:["Duration (seconds, optional)",(0,r.jsx)("input",{type:"number",value:u.duration,onChange:e=>w("duration",e.target.value),min:0,disabled:b})]}),(0,r.jsxs)("label",{children:["Video file * (MP4, max ",500," MB)",(0,r.jsx)("input",{type:"file",accept:"video/mp4",onChange:e=>{var a;return p((null===(a=e.target.files)||void 0===a?void 0:a[0])||null)},disabled:b})]}),(0,r.jsxs)("label",{children:["Thumbnail * (JPEG / PNG / WebP, max ",10," MB)",(0,r.jsx)("input",{type:"file",accept:"image/jpeg,image/png,image/webp",onChange:e=>{var a;return g((null===(a=e.target.files)||void 0===a?void 0:a[0])||null)},disabled:b})]}),b?(0,r.jsxs)("div",{className:"media-admin-progress",children:[(0,r.jsx)("div",{className:"media-admin-progress-bar",style:{width:`${x}%`}}),(0,r.jsxs)("span",{children:[x,"%"]})]}):null,(0,r.jsx)("button",{type:"submit",className:"media-admin-form-submit",disabled:b,children:b?"Uploading\u2026":"Upload"})]})]}),(0,r.jsxs)("section",{className:"media-admin-list",children:[(0,r.jsx)("h2",{children:"All media"}),o?(0,r.jsx)(d.A,{visible:!0}):0===i.length?(0,r.jsx)("div",{className:"media-admin-empty",children:"No media yet - upload your first asset above."}):(0,r.jsxs)("table",{className:"media-admin-table",children:[(0,r.jsx)("thead",{children:(0,r.jsxs)("tr",{children:[(0,r.jsx)("th",{children:"Thumb"}),(0,r.jsx)("th",{children:"Title"}),(0,r.jsx)("th",{children:"Category"}),(0,r.jsx)("th",{children:"Status"}),(0,r.jsx)("th",{children:"Views"}),(0,r.jsx)("th",{children:"Downloads"}),(0,r.jsx)("th",{children:"Actions"})]})}),(0,r.jsx)("tbody",{children:i.map(e=>(0,r.jsxs)("tr",{className:e.isPublished?"":"is-unpublished",children:[(0,r.jsx)("td",{children:(0,r.jsx)("img",{src:e.thumbnailUrl,alt:e.title,className:"media-admin-table-thumb",loading:"lazy"})}),(0,r.jsxs)("td",{children:[(0,r.jsx)("div",{className:"media-admin-table-title",children:e.title}),e.description?(0,r.jsx)("div",{className:"media-admin-table-desc",children:e.description}):null]}),(0,r.jsx)("td",{children:e.category}),(0,r.jsx)("td",{children:(0,r.jsx)("span",{className:"media-admin-status "+(e.isPublished?"live":"draft"),children:e.isPublished?"Live":"Draft"})}),(0,r.jsx)("td",{children:e.viewCount||0}),(0,r.jsx)("td",{children:e.downloadCount||0}),(0,r.jsxs)("td",{className:"media-admin-actions",children:[(0,r.jsx)("button",{type:"button",onClick:()=>(async e=>{const a=await l()({title:"Edit title",text:"",content:{element:"input",attributes:{value:e.title}},buttons:["Cancel","Save"]});if(null!=a&&a!==e.title)try{await(0,s.rS)(e.mediaId,{title:a}),await f()}catch(n){var i,t;l()("Update failed",(null===n||void 0===n||null===(i=n.response)||void 0===i||null===(t=i.data)||void 0===t?void 0:t.message)||n.message,"error")}})(e),children:"Edit"}),(0,r.jsx)("button",{type:"button",onClick:()=>(async e=>{try{const a=e.isPublished?s.aN:s.jk;await a(e.mediaId),await f()}catch(t){var a,i;l()("Failed",(null===t||void 0===t||null===(a=t.response)||void 0===a||null===(i=a.data)||void 0===i?void 0:i.message)||t.message,"error")}})(e),children:e.isPublished?"Unpublish":"Publish"}),(0,r.jsx)("button",{type:"button",className:"media-admin-danger",onClick:()=>(async e=>{if(await l()({title:`Delete "${e.title}"?`,text:"This permanently removes the video and thumbnail from S3 and the database.",icon:"warning",buttons:["Cancel","Delete"],dangerMode:!0}))try{await(0,s.j3)(e.mediaId),l()("Deleted","Media removed.","success"),await f()}catch(t){var a,i;l()("Delete failed",(null===t||void 0===t||null===(a=t.response)||void 0===a||null===(i=a.data)||void 0===i?void 0:i.message)||t.message,"error")}})(e),children:"Delete"})]})]},e.mediaId))})]})]})]})}},68695:function(e,a,i){e.exports=i.p+"static/media/loading_ajax.2da44e91dd42b146b1cd.gif"}}]);
2//# sourceMappingURL=3058.3bb6981e.chunk.js.map

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.