biohazard-vfx/.next/static/chunks/app/admin/team/page-12c40e56631cd291.js
Nicholai 7ed45d15da
Some checks failed
Build and Push to Docker Hub / Push Docker image to Docker Hub (push) Has been cancelled
Build and Push Docker Image / build-and-push (push) Has been cancelled
Dockerized baby
2025-08-19 05:35:01 -06:00

1 line
12 KiB
JavaScript

(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2126],{3960:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>m});var a=s(95155),r=s(12115),l=s(12108),i=s(35695),n=s(70627),c=s(87481),o=s(32941),d=s(49903);function m(){let{data:e,status:t}=(0,l.useSession)(),s=(0,i.useRouter)(),[m,u]=(0,r.useState)([]),[h,p]=(0,r.useState)(!0),[x,g]=(0,r.useState)(null),[f,b]=(0,r.useState)(!1);(0,r.useEffect)(()=>{"loading"!==t&&(e||s.push("/admin/login"))},[e,t,s]),(0,r.useEffect)(()=>{let t=async()=>{try{let e=await fetch("/api/team");if(!e.ok)throw Error("Failed to fetch team members");let t=await e.json();u(t)}catch(e){console.error("Error fetching team members:",e)}finally{p(!1)}};e&&t()},[e]);let j=async e=>{if(confirm("Are you sure you want to remove this team member?"))try{if(!(await fetch("/api/team/".concat(e),{method:"DELETE"})).ok)throw Error("Failed to delete member");let t=async()=>{try{let e=await fetch("/api/team");if(!e.ok)throw Error("Failed to fetch team members");let t=await e.json();u(t)}catch(e){console.error("Error fetching team members:",e)}};await t(),(0,c.o)({title:"Success",description:"Member deleted successfully",status:"success"})}catch(e){console.error("Error deleting member:",e),(0,c.o)({title:"Error",description:"Failed to delete member",status:"error"})}},v=async e=>{if(e.preventDefault(),x)try{let e;if(!(e=x.id?await fetch("/api/team/".concat(x.id),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(x)}):await fetch("/api/team",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(x)})).ok){let t=await e.json();throw Error(t.error||"Failed to save member")}let t=async()=>{try{let e=await fetch("/api/team");if(!e.ok)throw Error("Failed to fetch team members");let t=await e.json();u(t)}catch(e){console.error("Error fetching team members:",e)}};await t(),b(!1),g(null),(0,c.o)({title:"Success",description:"Member saved successfully",status:"success"})}catch(e){console.error("Error saving member:",e),(0,c.o)({title:"Error",description:"Failed to save member",status:"error"})}},y=async(e,t)=>{let s=m.findIndex(t=>t.id===e);if(-1===s)return;let a=[...m],r="up"===t?s-1:s+1;if(!(r<0)&&!(r>=m.length)){[a[s],a[r]]=[a[r],a[s]],a.forEach((e,t)=>e.order=t);try{let e=a.map(e=>fetch("/api/team/".concat(e.id),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}));await Promise.all(e);let t=async()=>{try{let e=await fetch("/api/team");if(!e.ok)throw Error("Failed to fetch team members");let t=await e.json();u(t)}catch(e){console.error("Error fetching team members:",e)}};await t()}catch(e){console.error("Error reordering members:",e),(0,c.o)({title:"Error",description:"Failed to reorder members",status:"error"})}}};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)(o.zY,{title:"Manage Team",subtitle:"Add, reorder, and update crew profiles.",actions:(0,a.jsx)(d.$n,{onClick:()=>{g({id:"",name:"",title:"",quote:"",image:"",instagram:"",order:m.length}),b(!0)},children:"Add Team Member"})}),(0,a.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:m.sort((e,t)=>e.order-t.order).map((e,t)=>(0,a.jsxs)("div",{className:"card overflow-hidden",children:[(0,a.jsx)("div",{className:"relative aspect-[3/4]",children:(0,a.jsx)(Image,{src:e.image,alt:e.name,fill:!0,className:"object-cover"})}),(0,a.jsxs)("div",{className:"p-6",children:[(0,a.jsx)("h3",{className:"text-xl font-bold text-white",children:e.name}),(0,a.jsx)("p",{className:"text-accent",children:e.title}),(0,a.jsxs)("p",{className:"text-sm italic text-primary mb-4",children:['"',e.quote,'"']}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(d.$n,{variant:"ghost",onClick:()=>y(e.id,"up"),disabled:0===t,children:"↑"}),(0,a.jsx)(d.$n,{variant:"ghost",onClick:()=>y(e.id,"down"),disabled:t===m.length-1,children:"↓"}),(0,a.jsx)(d.$n,{variant:"secondary",onClick:()=>{g(e),b(!0)},children:"Edit"}),(0,a.jsx)(d.$n,{variant:"danger",onClick:()=>j(e.id),children:"Remove"})]})]})]},e.id))}),f&&x&&(0,a.jsx)("div",{className:"modal-backdrop flex items-center justify-center p-6",onClick:e=>{e.target===e.currentTarget&&(b(!1),g(null))},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:x.id?"Edit Team Member":"Add Team Member"}),(0,a.jsxs)("form",{onSubmit:v,className:"space-y-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"label",children:"Name"}),(0,a.jsx)("input",{type:"text",value:x.name,onChange:e=>g({...x,name:e.target.value}),className:"input",required:!0})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"label",children:"Title"}),(0,a.jsx)("input",{type:"text",value:x.title,onChange:e=>g({...x,title:e.target.value}),className:"input",placeholder:"e.g., Founder & CEO",required:!0})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"label",children:"Quote"}),(0,a.jsx)("input",{type:"text",value:x.quote,onChange:e=>g({...x,quote:e.target.value}),className:"input",placeholder:"A memorable quote"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"label",children:"Photo"}),x.image&&(0,a.jsx)("div",{className:"relative w-full h-48 mb-2 rounded-lg overflow-hidden",children:(0,a.jsx)(Image,{src:x.image,alt:"Team member photo preview",fill:!0,className:"object-cover"})}),(0,a.jsx)(n.A,{endpoint:"imageUploader",onUploadComplete:e=>g({...x,image:e}),className:"mb-2"}),(0,a.jsx)("input",{type:"text",value:x.image,onChange:e=>g({...x,image:e.target.value}),className:"input",placeholder:"Or enter URL manually"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"block text-sm font-medium mb-2",children:"Instagram URL"}),(0,a.jsx)("input",{type:"text",value:x.instagram,onChange:e=>g({...x,instagram:e.target.value}),className:"w-full px-3 py-2 bg-bg-dark border border-bg-light rounded focus:border-accent focus:outline-none",placeholder:"https://www.instagram.com/username/"})]}),(0,a.jsxs)("div",{className:"flex justify-end gap-3 pt-4",children:[(0,a.jsx)(d.$n,{type:"button",variant:"ghost",onClick:()=>{b(!1),g(null)},children:"Cancel"}),(0,a.jsx)(d.$n,{type:"submit",children:"Save Member"})]})]})]})})]})}},32941:(e,t,s)=>{"use strict";s.d(t,{mc:()=>i,wn:()=>l,xA:()=>n,zY:()=>r});var a=s(95155);function r(e){let{title:t,subtitle:s,actions:r}=e;return(0,a.jsx)("div",{className:"mb-6",children:(0,a.jsxs)("div",{className:"flex items-start justify-between",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h1",{className:"text-3xl font-display tracking-tight text-white mb-2",children:t}),s&&(0,a.jsx)("p",{className:"text-text-muted text-base max-w-3xl",children:s})]}),r&&(0,a.jsx)("div",{className:"flex items-center gap-2",children:r})]})})}function l(e){let{children:t,className:s=""}=e;return(0,a.jsx)("section",{className:"section-spacing ".concat(s),children:t})}function i(e){let{children:t,className:s=""}=e;return(0,a.jsx)("div",{className:"w-full px-4 sm:px-6 lg:px-8 ".concat(s),children:t})}function n(e){let{children:t,cols:s=3,gap:r="md",className:l=""}=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-3",md:"gap-4",lg:"gap-6"}[r]," ").concat(l),children:t})}s(12115)},41474:(e,t,s)=>{Promise.resolve().then(s.bind(s,3960))},49903:(e,t,s)=>{"use strict";s.d(t,{$n:()=>i,z9:()=>n});var a=s(95155),r=s(6874),l=s.n(r);function i(e){let{variant:t="primary",size:s="md",isLoading:r=!1,children:l,className:i="",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-2 py-1 text-xs",md:"px-3 py-1.5 text-sm",lg:"px-4 py-2 text-base"}[s]," ").concat(i," ").concat(r?"opacity-75 cursor-wait":""),disabled:n||r,...c,children:r?(0,a.jsxs)("span",{className:"flex items-center gap-1",children:[(0,a.jsx)("span",{className:"spinner w-3 h-3"}),"Loading..."]}):l})}function n(e){let{variant:t="primary",size:s="md",children:r,className:i="",href:n="#",...c}=e;return(0,a.jsx)(l(),{href:n,className:"".concat({primary:"btn-primary",secondary:"btn-secondary",ghost:"btn-ghost"}[t]," ").concat({sm:"px-2 py-1 text-xs",md:"px-3 py-1.5 text-sm",lg:"px-4 py-2 text-base"}[s]," ").concat(i),...c,children:r})}s(12115)},70627:(e,t,s)=>{"use strict";s.d(t,{A:()=>c});var a=s(95155),r=s(12115);let{useUploadThing:l,uploadFiles:i}=(0,s(38897).KB)();var n=s(87481);function c(e){var t,s;let{endpoint:i,onUploadComplete:c,className:o}=e,[d,m]=(0,r.useState)(!1),{startUpload:u,permittedFileInfo:h}=l(i,{onClientUploadComplete:e=>{m(!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=>{m(!1),(0,n.o)({title:"Error",description:"Upload failed: ".concat(e.message),status:"error"})},onUploadBegin:()=>{m(!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==h||null==(t=h.config.image)?void 0:t.maxFileSize)||(null==h||null==(s=h.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&&u([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..."})]})}},87481:(e,t,s)=>{"use strict";s.d(t,{d:()=>d,o:()=>o});var a=s(12115);let r={ADD_TOAST:"ADD_TOAST",UPDATE_TOAST:"UPDATE_TOAST",DISMISS_TOAST:"DISMISS_TOAST",REMOVE_TOAST:"REMOVE_TOAST"},l=0,i=[],n={toasts:[]};function c(e){n=((e,t)=>{switch(t.type){case r.ADD_TOAST:return{...e,toasts:[t.toast,...e.toasts].slice(0,3)};case r.DISMISS_TOAST:{let{toastId:s}=t;return{...e,toasts:e.toasts.map(e=>e.id===s?{...e,status:"error"}:e)}}case r.REMOVE_TOAST:return{...e,toasts:e.toasts.filter(e=>e.id!==t.toastId)}}})(n,e),i.forEach(e=>{e(n)})}function o(e){var t;let{...s}=e,a=(l=(l+1)%Number.MAX_SAFE_INTEGER).toString();return c({type:r.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:r.DISMISS_TOAST,toastId:a}),update:e=>c({type:r.UPDATE_TOAST,toast:{...e,id:a}})}}function d(){let[e,t]=a.useState(n);return a.useEffect(()=>(i.push(t),()=>{let e=i.indexOf(t);e>-1&&i.splice(e,1)}),[e]),{...e,toast:o,dismiss:e=>c({type:r.DISMISS_TOAST,toastId:e})}}}},e=>{e.O(0,[6874,6454,8897,8441,5964,7358],()=>e(e.s=41474)),_N_E=e.O()}]);