PageSourceSearch

https://peacock-studio.erniesg.workers.dev/_next/static/chunks/pages/upload-custom-visual-d639beba2b8fc83f.js

js peacock-studio.erniesg.workers.dev collected 2026-10-03 08:09:34 UTC 4,403 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[414],{6788:(e,l,a)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/upload-custom-visual",function(){return a(9928)}])},9928:(e,l,a)=>{"use strict";a.r(l),a.d(l,{default:()=>n});var t=a(4848),s=a(6540),r=a(4335),i=a(6715);let n=e=>{let{userRole:l}=e;(0,i.useRouter)();let[a,n]=(0,s.useState)(""),[o,d]=(0,s.useState)(""),[c,u]=(0,s.useState)(null),[m,p]=(0,s.useState)(!1),[x,h]=(0,s.useState)(""),[f,v]=(0,s.useState)(null),b=(0,s.useRef)(null);if(!l)return(0,t.jsx)("p",{className:"text-center mt-8",children:"Please log in to access this page."});let g=e=>'<iframe class="landscape-frame" style="width: 100%; height: 100%; border: none;" title="'.concat(a,'" src="').concat(e,'"></iframe>'),N=e=>{navigator.clipboard.writeText(e)},j=async e=>{if(e.preventDefault(),h(""),v(null),!a.trim()){h("Title is required.");return}if(!c){h("Please choose an HTML file.");return}p(!0);try{let e=new FormData;e.append("file",c),e.append("title",a.trim()),o.trim()&&e.append("slug",o.trim());let l=localStorage.getItem("authToken"),t=await r.A.post("/api/custom-visual",e,{headers:{Authorization:"Bearer ".concat(l),"Content-Type":"multipart/form-data"}});v({id:t.data.id,viewUrl:t.data.view_url}),n(""),d(""),u(null),b.current&&(b.current.value="")}catch(e){var l,t;h((null===(t=e.response)||void 0===t?void 0:null===(l=t.data)||void 0===l?void 0:l.detail)||"Upload failed. Please try again.")}finally{p(!1)}};return(0,t.jsxs)("div",{children:[(0,t.jsx)("h1",{className:"page-title",children:"Upload Custom HTML Visual"}),(0,t.jsx)("p",{className:"text-center text-gray-600 mb-8",children:"Upload an HTML file to host it on Peacock for embedding in WordPress."}),(0,t.jsxs)("div",{className:"max-w-xl mx-auto",children:[(0,t.jsxs)("form",{onSubmit:j,children:[(0,t.jsxs)("div",{className:"form-group",children:[(0,t.jsxs)("label",{className:"form-label",htmlFor:"visual-title",children:["Title ",(0,t.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,t.jsx)("input",{id:"visual-title",type:"text",className:"form-input",value:a,onChange:e=>n(e.target.value),placeholder:"e.g. SEA AI Startup Alumni Explorer"})]}),(0,t.jsxs)("div",{className:"form-group",children:[(0,t.jsx)("label",{className:"form-label",htmlFor:"visual-slug",children:"Slug (optional)"}),(0,t.jsx)("input",{id:"visual-slug",type:"text",className:"form-input",value:o,onChange:e=>d(e.target.value),placeholder:"e.g. sea-ai-alumni-explorer"}),(0,t.jsx)("p",{className:"text-sm text-gray-500 mt-1",children:"URL-friendly name. Auto-generated from title if left blank."})]}),(0,t.jsxs)("div",{className:"form-group",children:[(0,t.jsxs)("label",{className:"form-label",htmlFor:"visual-file",children:["Choose HTML file ",(0,t.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,t.jsx)("input",{id:"visual-file",ref:b,type:"file",accept:".html",onChange:e=>{var l;let a=null===(l=e.target.files)||void 0===l?void 0:l[0];if(a){if(!a.name.toLowerCase().endsWith(".html")){h("Only .html files are accepted."),u(null);return}u(a),h("")}},className:"form-input"})]}),x&&(0,t.jsx)("p",{className:"text-red-500 mb-4",children:x}),(0,t.jsx)("button",{type:"submit",className:"btn-primary w-full py-3",disabled:m,children:m?"Uploading...":"Upload"})]}),f&&(0,t.jsxs)("div",{className:"mt-8 p-4 bg-green-50 border border-green-200 rounded-lg",children:[(0,t.jsx)("p",{className:"text-green-700 font-semibold mb-4",children:"Visual uploaded successfully"}),(0,t.jsxs)("div",{className:"mb-4",children:[(0,t.jsx)("label",{className:"form-label",children:"View URL"}),(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsx)("input",{type:"text",readOnly:!0,className:"form-input flex-1",value:f.viewUrl}),(0,t.jsx)("button",{type:"button",className:"btn-secondary",onClick:()=>N(f.viewUrl),children:"Copy"}),(0,t.jsx)("a",{href:f.viewUrl,target:"_blank",rel:"noopener noreferrer",className:"btn-primary text-center",children:"View"})]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"form-label",children:"Embed Code"}),(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsx)("input",{type:"text",readOnly:!0,className:"form-input flex-1 text-sm",value:g(f.viewUrl)}),(0,t.jsx)("button",{type:"button",className:"btn-secondary",onClick:()=>N(g(f.viewUrl)),children:"Copy"})]})]})]})]})]})}}},e=>{var l=l=>e(e.s=l);e.O(0,[335,636,593,792],()=>l(6788)),_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.