PageSourceSearch

https://downundervisa.com/assets/upload-DrfNSrB7.js

js downundervisa.com collected 2026-10-09 05:19:40 UTC 7,019 bytes, 5 lines download raw bytes

1import{u as N,r as a,j as e,L as h,d3 as w}from"./main-Bo0oayNO.js";function C(){const p=N(),l=a.useRef(null),[i,d]=a.useState(!1),[c,t]=a.useState(null),[g,o]=a.useState(!1),[s,m]=a.useState(null),u=r=>{if(t(null),!!r){if(!r.name.endsWith(".zip")){t("Please select a .zip file");return}if(r.size>10*1024*1024){t("File is too large. Maximum size is 10MB.");return}m(r)}},f=async()=>{if(s){d(!0),t(null);try{const r=await s.arrayBuffer(),n=btoa(new Uint8Array(r).reduce((v,k)=>v+String.fromCharCode(k),"")),x=await w({data:{filename:s.name,fileData:n}});x.success?p({to:"/admin/appearance"}):t(x.error||"Failed to upload theme")}catch(r){console.error("Upload error:",r),t("Failed to upload theme. Please try again.")}finally{d(!1)}}},j=r=>{r.preventDefault(),o(!0)},y=r=>{r.preventDefault(),o(!1)},b=r=>{r.preventDefault(),o(!1);const n=r.dataTransfer.files[0];u(n)};return e.jsxs("div",{className:"max-w-2xl mx-auto",children:[e.jsxs("div",{className:"flex items-center gap-4 mb-6",children:[e.jsx(h,{to:"/admin/appearance",className:"p-2 text-gray-500 hover:text-gray-700 hover:bg-gray-100 rounded-lg transition-colors",children:e.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold text-gray-900",children:"Upload Theme"}),e.jsx("p",{className:"text-gray-500 text-sm mt-1",children:"Install a custom theme by uploading a .zip file"})]})]}),e.jsxs("div",{className:"bg-white rounded-lg shadow-xs border border-gray-200 p-6",children:[c&&e.jsxs("div",{className:"mb-6 p-4 bg-red-50 border border-red-200 text-red-700 rounded-lg flex items-start gap-3",children:[e.jsx("svg",{className:"w-5 h-5 flex-shrink-0 mt-0.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),e.jsx("span",{children:c})]}),e.jsxs("div",{onClick:()=>l.current?.click(),onDragOver:j,onDragLeave:y,onDrop:b,className:`
2            border-2 border-dashed rounded-lg p-8 text-center cursor-pointer transition-colors
3            ${g?"border-primary-500 bg-primary-50":"border-gray-300 hover:border-gray-400 hover:bg-gray-50"}
4            ${s?"bg-green-50 border-green-400":""}
5          `,children:[e.jsx("input",{ref:l,type:"file",accept:".zip",onChange:r=>u(r.target.files?.[0]||null),className:"hidden"}),s?e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"w-12 h-12 bg-green-100 rounded-lg flex items-center justify-center mx-auto",children:e.jsx("svg",{className:"w-6 h-6 text-green-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})}),e.jsx("p",{className:"font-medium text-gray-900",children:s.name}),e.jsxs("p",{className:"text-sm text-gray-500",children:[(s.size/1024/1024).toFixed(2)," MB"]}),e.jsx("button",{type:"button",onClick:r=>{r.stopPropagation(),m(null)},className:"text-sm text-red-600 hover:text-red-700",children:"Remove"})]}):e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"w-12 h-12 bg-gray-100 rounded-lg flex items-center justify-center mx-auto",children:e.jsx("svg",{className:"w-6 h-6 text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M7 16a4 4 0 01-.88-7.903A5 5 0 1115.9 6L16 6a5 5 0 011 9.9M15 13l-3-3m0 0l-3 3m3-3v12"})})}),e.jsx("p",{className:"font-medium text-gray-900",children:"Drop your theme .zip file here"}),e.jsx("p",{className:"text-sm text-gray-500",children:"or click to browse"})]})]}),e.jsxs("div",{className:"mt-6 p-4 bg-gray-50 rounded-lg",children:[e.jsx("h3",{className:"font-medium text-gray-900 mb-2",children:"Theme Requirements"}),e.jsxs("ul",{className:"text-sm text-gray-600 space-y-1",children:[e.jsxs("li",{className:"flex items-start gap-2",children:[e.jsx("svg",{className:"w-4 h-4 text-gray-400 mt-0.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"})}),"Must be a .zip archive"]}),e.jsxs("li",{className:"flex items-start gap-2",children:[e.jsx("svg",{className:"w-4 h-4 text-gray-400 mt-0.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"})}),"Must contain a valid theme.json file"]}),e.jsxs("li",{className:"flex items-start gap-2",children:[e.jsx("svg",{className:"w-4 h-4 text-gray-400 mt-0.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"})}),"Maximum file size: 10MB"]})]})]}),e.jsx("div",{className:"mt-6",children:e.jsx("button",{type:"button",className:"text-sm text-primary-600 hover:text-primary-700 font-medium",onClick:()=>{const r={name:"My Custom Theme",version:"1.0.0",author:"Your Name",description:"A custom theme for StackPress",colors:{primary:"#3b82f6",primaryLight:"#60a5fa",primaryDark:"#2563eb",accent:"#8b5cf6",background:"#ffffff",backgroundAlt:"#f9fafb",foreground:"#111827",foregroundMuted:"#6b7280",border:"#e5e7eb"},darkColors:{background:"#111827",backgroundAlt:"#1f2937",foreground:"#f9fafb",foregroundMuted:"#9ca3af",border:"#374151"},fonts:{heading:"Inter, system-ui, sans-serif",body:"Inter, system-ui, sans-serif",mono:"JetBrains Mono, monospace"},layout:{maxWidth:"1200px",contentWidth:"768px",borderRadius:"0.5rem",headerHeight:"64px"},features:{sidebar:!0,heroSection:!0,featuredPosts:!0,darkMode:!0}};navigator.clipboard.writeText(JSON.stringify(r,null,2)),alert("Example theme.json copied to clipboard!")},children:"Copy example theme.json to clipboard"})}),e.jsxs("div",{className:"mt-6 flex gap-3",children:[e.jsx("button",{onClick:f,disabled:!s||i,className:"flex-1 px-4 py-2 bg-primary-600 text-white font-medium rounded-lg hover:bg-primary-700 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:i?e.jsxs("span",{className:"flex items-center justify-center gap-2",children:[e.jsxs("svg",{className:"w-4 h-4 animate-spin",fill:"none",viewBox:"0 0 24 24",children:[e.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),e.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),"Uploading..."]}):"Upload & Install Theme"}),e.jsx(h,{to:"/admin/appearance",className:"px-4 py-2 border border-gray-200 text-gray-700 font-medium rounded-lg hover:bg-gray-50 transition-colors",children:"Cancel"})]})]})]})}export{C as component};

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.