(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,11088,e=>{"use strict";var s=e.i(43476),t=e.i(71645),r=e.i(18566),d=e.i(11795);e.s(["default",0,function({initial:e}){let l=(0,d.createClient)(),i=(0,r.useRouter)(),[a,n]=(0,t.useState)(e),[c,o]=(0,t.useState)(null),[m,u]=(0,t.useState)(null);async function x(e,s){o(e.id),u(null),n(a.filter(s=>s.id!==e.id));let{error:t}=s?await l.from("gallery_photos").update({status:"approved"}).eq("id",e.id):await l.from("gallery_photos").delete().eq("id",e.id);if(o(null),t){u(t.message),n(a);return}i.refresh()}if(!a.length)return(0,s.jsx)("p",{className:"text-sm text-be-muted",children:"No pending submissions. 🎉"});let b=new Map;for(let e of a){let s=b.get(e.albumTitle)??[];s.push(e),b.set(e.albumTitle,s)}return(0,s.jsxs)("div",{className:"space-y-6",children:[m&&(0,s.jsx)("p",{className:"text-sm text-red-600",children:m}),[...b.entries()].map(([e,t])=>(0,s.jsxs)("div",{className:"rounded-lg border border-be-border bg-be-surface p-4",children:[(0,s.jsxs)("p",{className:"mb-3 text-sm font-medium",children:[e," ",(0,s.jsxs)("span",{className:"text-be-muted",children:["· ",t.length," pending"]})]}),(0,s.jsx)("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-3",children:t.map(e=>(0,s.jsxs)("div",{className:"overflow-hidden rounded-md border border-be-border",children:[(0,s.jsx)("img",{src:e.url,alt:"",className:"aspect-square w-full object-cover"}),(0,s.jsxs)("div",{className:"p-2",children:[(0,s.jsx)("p",{className:"truncate text-xs text-be-muted",children:e.creditName?e.creditUrl?(0,s.jsxs)("a",{href:e.creditUrl,target:"_blank",rel:"noopener noreferrer",className:"hover:underline",children:["📷 ",e.creditName]}):(0,s.jsxs)(s.Fragment,{children:["📷 ",e.creditName]}):"No credit"}),(0,s.jsxs)("div",{className:"mt-2 flex gap-2",children:[(0,s.jsx)("button",{onClick:()=>x(e,!0),disabled:c===e.id,className:"flex-1 rounded bg-green-600 px-2 py-1 text-xs font-medium text-white hover:bg-green-700 disabled:opacity-50",children:"Approve"}),(0,s.jsx)("button",{onClick:()=>x(e,!1),disabled:c===e.id,className:"flex-1 rounded bg-be-surface-2 px-2 py-1 text-xs font-medium text-be-text hover:bg-be-border disabled:opacity-50",children:"Reject"})]})]})]},e.id))})]},e))]})}])}]);