1 line
11 KiB
JavaScript
1 line
11 KiB
JavaScript
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7709],{32941:(e,t,s)=>{"use strict";s.d(t,{mc:()=>r,wn:()=>i,xA:()=>n,zY:()=>l});var a=s(95155);function l(e){let{title:t,subtitle:s,actions:l}=e;return(0,a.jsx)("div",{className:"mb-8",children:(0,a.jsxs)("div",{className:"flex items-start justify-between",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h1",{className:"text-4xl font-display tracking-tight text-white mb-2",children:t}),s&&(0,a.jsx)("p",{className:"text-text-muted text-lg max-w-3xl",children:s})]}),l&&(0,a.jsx)("div",{className:"flex items-center gap-3",children:l})]})})}function i(e){let{children:t,className:s=""}=e;return(0,a.jsx)("section",{className:"section-spacing ".concat(s),children:t})}function r(e){let{children:t,className:s=""}=e;return(0,a.jsx)("div",{className:"container-custom ".concat(s),children:t})}function n(e){let{children:t,cols:s=3,gap:l="md",className:i=""}=e;return(0,a.jsx)("div",{className:"grid ".concat({1:"grid-cols-1",2:"grid-cols-1 md:grid-cols-2",3:"grid-cols-1 md:grid-cols-2 lg:grid-cols-3",4:"grid-cols-1 md:grid-cols-2 lg:grid-cols-4"}[s]," ").concat({sm:"gap-4",md:"gap-6",lg:"gap-8"}[l]," ").concat(i),children:t})}s(12115)},49903:(e,t,s)=>{"use strict";s.d(t,{$n:()=>r,z9:()=>n});var a=s(95155),l=s(6874),i=s.n(l);function r(e){let{variant:t="primary",size:s="md",isLoading:l=!1,children:i,className:r="",disabled:n,...c}=e;return(0,a.jsx)("button",{className:"".concat({primary:"btn-primary",secondary:"btn-secondary",ghost:"btn-ghost",danger:"btn bg-red-500 hover:bg-red-600 text-white"}[t]," ").concat({sm:"px-3 py-1.5 text-sm",md:"px-4 py-2",lg:"px-6 py-3 text-lg"}[s]," ").concat(r," ").concat(l?"opacity-75 cursor-wait":""),disabled:n||l,...c,children:l?(0,a.jsxs)("span",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"spinner w-4 h-4"}),"Loading..."]}):i})}function n(e){let{variant:t="primary",size:s="md",children:l,className:r="",href:n="#",...c}=e;return(0,a.jsx)(i(),{href:n,className:"".concat({primary:"btn-primary",secondary:"btn-secondary",ghost:"btn-ghost"}[t]," ").concat({sm:"px-3 py-1.5 text-sm",md:"px-4 py-2",lg:"px-6 py-3 text-lg"}[s]," ").concat(r),...c,children:l})}s(12115)},66766:(e,t,s)=>{"use strict";s.d(t,{default:()=>l.a});var a=s(71469),l=s.n(a)},70627:(e,t,s)=>{"use strict";s.d(t,{A:()=>c});var a=s(95155),l=s(12115);let{useUploadThing:i,uploadFiles:r}=(0,s(38897).KB)();var n=s(87481);function c(e){var t,s;let{endpoint:r,onUploadComplete:c,className:o}=e,[d,u]=(0,l.useState)(!1),{startUpload:m,permittedFileInfo:x}=i(r,{onClientUploadComplete:e=>{u(!1),e&&e[0]&&(null==c||c(e[0].url,new File([],e[0].name)),(0,n.o)({title:"Success",description:"File uploaded successfully!",status:"success"}))},onUploadError:e=>{u(!1),(0,n.o)({title:"Error",description:"Upload failed: ".concat(e.message),status:"error"})},onUploadBegin:()=>{u(!0)}});return(0,a.jsxs)("div",{className:o,children:[(0,a.jsx)("div",{className:"flex items-center justify-center w-full",children:(0,a.jsxs)("label",{className:"flex flex-col items-center justify-center w-full h-64 border-2 border-dashed border-text-muted rounded-lg cursor-pointer bg-bg-light hover:bg-bg-light/50 transition-colors",children:[(0,a.jsxs)("div",{className:"flex flex-col items-center justify-center pt-5 pb-6",children:[(0,a.jsx)("svg",{className:"w-8 h-8 mb-4 text-text-muted","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 20 16",children:(0,a.jsx)("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M13 13h3a3 3 0 0 0 0-6h-.025A5.56 5.56 0 0 0 16 6.5 5.5 5.5 0 0 0 5.207 5.021C5.137 5.017 5.071 5 5 5a4 4 0 0 0 0 8h2.167M10 15V6m0 0L8 8m2-2 2 2"})}),(0,a.jsxs)("p",{className:"mb-2 text-sm text-text-muted",children:[(0,a.jsx)("span",{className:"font-semibold",children:"Click to upload"})," or drag and drop"]}),(0,a.jsx)("p",{className:"text-xs text-text-muted",children:(null==x||null==(t=x.config.image)?void 0:t.maxFileSize)||(null==x||null==(s=x.config.video)?void 0:s.maxFileSize)||"Any file type"})]}),(0,a.jsx)("input",{type:"file",className:"hidden",onChange:e=>{var t;let s=null==(t=e.target.files)?void 0:t[0];s&&m([s]).catch(e=>{(0,n.o)({title:"Error",description:"Upload failed. Please try again.",status:"error"})})},disabled:d})]})}),d&&(0,a.jsx)("p",{className:"text-text-muted mt-2 text-center",children:"Uploading..."})]})}},71469:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),!function(e,t){for(var s in t)Object.defineProperty(e,s,{enumerable:!0,get:t[s]})}(t,{default:function(){return c},getImageProps:function(){return n}});let a=s(88229),l=s(38883),i=s(33063),r=a._(s(51193));function n(e){let{props:t}=(0,l.getImgProps)(e,{defaultLoader:r.default,imgConf:{deviceSizes:[640,750,828,1080,1200,1920,2048,3840],imageSizes:[16,32,48,64,96,128,256,384],path:"/_next/image",loader:"default",dangerouslyAllowSVG:!1,unoptimized:!1}});for(let[e,s]of Object.entries(t))void 0===s&&delete t[e];return{props:t}}let c=i.Image},78927:(e,t,s)=>{Promise.resolve().then(s.bind(s,99931))},87481:(e,t,s)=>{"use strict";s.d(t,{d:()=>d,o:()=>o});var a=s(12115);let l={ADD_TOAST:"ADD_TOAST",UPDATE_TOAST:"UPDATE_TOAST",DISMISS_TOAST:"DISMISS_TOAST",REMOVE_TOAST:"REMOVE_TOAST"},i=0,r=[],n={toasts:[]};function c(e){n=((e,t)=>{switch(t.type){case l.ADD_TOAST:return{...e,toasts:[t.toast,...e.toasts].slice(0,3)};case l.DISMISS_TOAST:{let{toastId:s}=t;return{...e,toasts:e.toasts.map(e=>e.id===s?{...e,status:"error"}:e)}}case l.REMOVE_TOAST:return{...e,toasts:e.toasts.filter(e=>e.id!==t.toastId)}}})(n,e),r.forEach(e=>{e(n)})}function o(e){var t;let{...s}=e,a=(i=(i+1)%Number.MAX_SAFE_INTEGER).toString();return c({type:l.ADD_TOAST,toast:{...s,id:a,status:null!=(t=s.status)?t:"info",title:s.title,description:s.description,action:s.action}}),{id:a,dismiss:()=>c({type:l.DISMISS_TOAST,toastId:a}),update:e=>c({type:l.UPDATE_TOAST,toast:{...e,id:a}})}}function d(){let[e,t]=a.useState(n);return a.useEffect(()=>(r.push(t),()=>{let e=r.indexOf(t);e>-1&&r.splice(e,1)}),[e]),{...e,toast:o,dismiss:e=>c({type:l.DISMISS_TOAST,toastId:e})}}},99931:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>m});var a=s(95155),l=s(12115),i=s(12108),r=s(35695),n=s(66766),c=s(87481),o=s(70627),d=s(32941),u=s(49903);function m(){let{data:e,status:t}=(0,i.useSession)(),s=(0,r.useRouter)(),[m,x]=(0,l.useState)([]),[h,p]=(0,l.useState)(!0),[g,f]=(0,l.useState)("all"),[v,j]=(0,l.useState)(!1),[y,b]=(0,l.useState)(!1);(0,l.useEffect)(()=>{"loading"!==t&&(e||s.push("/admin/login"))},[e,t,s]),(0,l.useEffect)(()=>{let e=localStorage.getItem("biohazard_media_files");e&&x(JSON.parse(e)),p(!1)},[]);let N=e=>{localStorage.setItem("biohazard_media_files",JSON.stringify(e)),x(e)},S="all"===g?m:m.filter(e=>e.category===g),w=["all","uncategorized","projects","blog","team","other"];return"loading"===t||h?(0,a.jsx)("div",{className:"flex items-center justify-center min-h-[40vh]",children:(0,a.jsx)("span",{className:"spinner w-8 h-8"})}):(0,a.jsxs)("div",{children:[(0,a.jsx)(d.zY,{title:"Media Library",subtitle:"Browse, upload, and organize your assets.",actions:(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("select",{value:g,onChange:e=>f(e.target.value),className:"input w-auto",children:w.map(e=>(0,a.jsx)("option",{value:e,children:e.charAt(0).toUpperCase()+e.slice(1)},e))}),(0,a.jsx)(u.$n,{onClick:()=>b(!0),children:v?"Uploading...":"Upload Files"})]})}),0===S.length?(0,a.jsx)("div",{className:"text-center py-12 text-text-muted",children:"No files in this category. Upload some files to get started!"}):(0,a.jsx)("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 xl:grid-cols-5 gap-4",children:S.map(e=>{var t;return(0,a.jsxs)("div",{className:"card overflow-hidden group",children:[(0,a.jsxs)("div",{className:"relative aspect-square bg-bg-dark",children:["image"===e.type?(0,a.jsx)(n.default,{src:e.url,alt:e.name,fill:!0,className:"object-cover"}):"video"===e.type?(0,a.jsx)("video",{src:e.url,className:"w-full h-full object-cover"}):(0,a.jsx)("div",{className:"flex items-center justify-center h-full",children:(0,a.jsxs)("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"text-text-muted",children:[(0,a.jsx)("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),(0,a.jsx)("path",{d:"M5 15H4a2 2 0 01-2-2V4a2 2 0 012-2h9a2 2 0 012 2v1"})]})}),(0,a.jsxs)("div",{className:"absolute inset-0 bg-black/75 opacity-0 group-hover:opacity-100 transition-opacity flex items-center justify-center space-x-2",children:[(0,a.jsx)("button",{onClick:()=>navigator.clipboard.writeText(e.url),className:"p-2 bg-white/20 rounded hover:bg-white/30",title:"Copy URL",children:(0,a.jsxs)("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[(0,a.jsx)("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),(0,a.jsx)("path",{d:"M5 15H4a2 2 0 01-2-2V4a2 2 0 012-2h9a2 2 0 012 2v1"})]})}),(0,a.jsx)("button",{onClick:()=>{var t;return t=e.id,void(confirm("Are you sure you want to delete this file?")&&N(m.filter(e=>e.id!==t)))},className:"p-2 bg-red-500/20 rounded hover:bg-red-500/30",title:"Delete",children:(0,a.jsx)("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:(0,a.jsx)("path",{d:"M3 6h18M19 6v14a2 2 0 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2"})})})]})]}),(0,a.jsxs)("div",{className:"p-3",children:[(0,a.jsx)("p",{className:"text-sm font-medium truncate",title:e.name,children:e.name}),(0,a.jsx)("p",{className:"text-xs text-text-muted",children:(t=e.size)<1024?t+" B":t<1048576?(t/1024).toFixed(1)+" KB":(t/1048576).toFixed(1)+" MB"}),(0,a.jsx)("select",{value:e.category,onChange:t=>{var s,a;return s=e.id,a=t.target.value,void N(m.map(e=>e.id===s?{...e,category:a}:e))},className:"mt-2 w-full text-xs input",children:w.filter(e=>"all"!==e).map(e=>(0,a.jsx)("option",{value:e,children:e.charAt(0).toUpperCase()+e.slice(1)},e))})]})]},e.id)})}),y&&(0,a.jsx)("div",{className:"modal-backdrop flex items-center justify-center p-6",onClick:e=>{e.target===e.currentTarget&&b(!1)},children:(0,a.jsxs)("div",{className:"modal-content left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 max-w-2xl w-full p-6 max-h-[90vh] overflow-y-auto",children:[(0,a.jsx)("h2",{className:"text-2xl font-semibold text-white mb-6",children:"Upload Files"}),(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsx)(o.A,{endpoint:"imageUploader",onUploadComplete:e=>{(0,c.o)({title:"Success",description:"File uploaded successfully!",status:"success"}),b(!1)},className:"mb-4"}),(0,a.jsx)("div",{className:"flex justify-end gap-3 pt-4",children:(0,a.jsx)(u.$n,{variant:"ghost",type:"button",onClick:()=>b(!1),children:"Close"})})]})]})})]})}}},e=>{e.O(0,[6874,3063,6454,8897,8441,5964,7358],()=>e(e.s=78927)),_N_E=e.O()}]); |