PageSourceSearch

https://downundervisa.com/assets/_id-Cf61Bz8e.js

js downundervisa.com collected 2026-10-09 05:19:09 UTC 6,252 bytes, 1 lines download raw bytes

1import{cC as D,u as k,r as n,j as e,cD as C,cE as S,cF as F,cG as M}from"./main-Bo0oayNO.js";import{f as R}from"./index-ThM9GGfP.js";import{f as L}from"./media-utils-lVSx5BZ9.js";function W(){const{media:a}=D.useLoaderData(),r=k(),[d,o]=n.useState(!1),[l,m]=n.useState(!1),[x,h]=n.useState(!1),[s,u]=n.useState({altText:a.altText||"",caption:a.caption||"",description:a.description||""}),g=a.mimeType.startsWith("image/"),j=a.mimeType.startsWith("video/"),y=a.mimeType.startsWith("audio/"),i=a.deletedAt!==null,c=t=>{const{name:v,value:w}=t.target;u(T=>({...T,[v]:w}))},f=async t=>{t.preventDefault(),o(!0);try{await C({data:{id:a.id,altText:s.altText||void 0,caption:s.caption||void 0,description:s.description||void 0}}),r({to:"/admin/media",search:{page:1,type:"all",search:"",status:"active"}})}finally{o(!1)}},p=async()=>{if(confirm(i?"Permanently delete this file? This cannot be undone.":"Move this file to trash?")){m(!0);try{i?await F({data:a.id}):await M({data:a.id}),r({to:"/admin/media",search:{page:1,type:"all",search:"",status:"active"}}
1)}finally{m(!1)}}},b=async()=>{if(confirm("Restore this file?")){h(!0);try{await S({data:a.id}),r({to:"/admin/media",search:{page:1,type:"all",search:"",status:"active"}})}finally{h(!1)}}},N=t=>{navigator.clipboard.writeText(t)};return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold text-gray-900",children:"Edit Media"}),e.jsx("p",{className:"text-gray-600 truncate max-w-md",children:a.originalFilename})]}),e.jsx("a",{href:"/admin/media",className:"btn-secondary",children:"Back to Library"})]}),i&&e.jsx("div",{className:"bg-red-50 border border-red-200 text-red-700 px-4 py-3 rounded-lg",children:"This file is in the trash. Restore it to make it available again."}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[e.jsxs("div",{className:"card p-6",children:[e.jsx("h2",{className:"text-lg font-medium text-gray-900 mb-4",children:"Preview"}),e.jsx("div",{className:"bg-gray-100 rounded-lg overflow-hidden",children:g?e.jsx("img",{src:a.url,alt:a.altText||a.originalFilename,className:"w-full h-auto max-h-96 object-contain"}):j?e.jsx("video",{src:a.url,controls:!0,className:"w-full h-auto max-h-96"}):y?e.jsx("div",{className:"p-8",children:e.jsx("audio",{src:a.url,controls:!0,className:"w-full"})}):e.jsxs("div",{className:"p-8 text-center",children:[e.jsx("svg",{className:"mx-auto w-16 h-16 text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"})}),e.jsx("p",{className:"mt-2 text-sm text-gray-500",children:a.mimeType})]})}),e.jsxs("div",{className:"mt-4 space-y-2 text-sm",children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-gray-500",children:"File size:"}),e.jsx("span",{className:"text-gray-900",children:L(a.fileSize)})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-gray-500",children:"Type:"}),e.jsx("span",{className:"text-gray-900",children:a.mimeType})]}),a.width&&a.height&&e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-gray-500",children:"Dimensions:"}),e.jsxs("span",{className:"text-gray-900",children:[a.width," x ",a.height]})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-gray-500",children:"Uploaded:"}),e.jsx("span",{className:"text-gray-900",children:R(a.createdAt)})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-gray-500",children:"Uploaded by:"}),e.jsx("span",{className:"text-gray-900",children:a.uploader?.displayName||a.uploader?.username||"Unknown"})]})]}),e.jsxs("div",{className:"mt-4",children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"File URL"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{type:"text",readOnly:!0,value:a.url,className:"input flex-1 bg-gray-50"}),e.jsx("button",{type:"button",onClick:()=>N(a.url),className:"btn-secondary",title:"Copy URL",children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})})})]})]})]}),e.jsxs("div",{className:"card p-6",children:[e.jsx("h2",{className:"text-lg font-medium text-gray-900 mb-4",children:"Details"}),e.jsxs("form",{onSubmit:f,className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:"altText",className:"label",children:"Alt Text"}),e.jsx("input",{type:"text",id:"altText",name:"altText",value:s.altText,onChange:c,className:"input",placeholder:"Describe the image for accessibility"}),e.jsx("p",{className:"mt-1 text-xs text-gray-500",children:"Describe the image for screen readers and SEO"})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"caption",className:"label",children:"Caption"}),e.jsx("input",{type:"text",id:"caption",name:"caption",value:s.caption,onChange:c,className:"input",placeholder:"Optional caption"})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"description",className:"label",children:"Description"}),e.jsx("textarea",{id:"description",name:"description",value:s.description,onChange:c,rows:4,className:"input",placeholder:"Optional longer description"})]}),e.jsxs("div",{className:"flex gap-4 pt-4",children:[e.jsx("button",{type:"submit",disabled:d||i,className:"btn-primary",children:d?"Saving...":"Save Changes"}),i?e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",onClick:b,disabled:x,className:"btn-secondary",children:x?"Restoring...":"Restore"}),e.jsx("button",{type:"button",onClick:p,disabled:l,className:"btn-danger",children:l?"Deleting...":"Delete Permanently"})]}):e.jsx("button",{type:"button",onClick:p,disabled:l,className:"btn-danger",children:l?"Moving...":"Move to Trash"})]})]})]})]})]})}export{W 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.