module.exports=[99517,a=>{"use strict";var b=a.i(87924),c=a.i(72131),d=a.i(50944),e=a.i(95445);a.s(["default",0,function({initial:a}){let f=(0,e.createClient)(),g=(0,d.useRouter)(),[h,i]=(0,c.useState)(a),[j,k]=(0,c.useState)(null),[l,m]=(0,c.useState)(null);async function n(a,b){k(a.id),m(null),i(h.filter(b=>b.id!==a.id));let{error:c}=b?await f.from("gallery_photos").update({status:"approved"}).eq("id",a.id):await f.from("gallery_photos").delete().eq("id",a.id);if(k(null),c){m(c.message),i(h);return}g.refresh()}if(!h.length)return(0,b.jsx)("p",{className:"text-sm text-be-muted",children:"No pending submissions. 🎉"});let o=new Map;for(let a of h){let b=o.get(a.albumTitle)??[];b.push(a),o.set(a.albumTitle,b)}return(0,b.jsxs)("div",{className:"space-y-6",children:[l&&(0,b.jsx)("p",{className:"text-sm text-red-600",children:l}),[...o.entries()].map(([a,c])=>(0,b.jsxs)("div",{className:"rounded-lg border border-be-border bg-be-surface p-4",children:[(0,b.jsxs)("p",{className:"mb-3 text-sm font-medium",children:[a," ",(0,b.jsxs)("span",{className:"text-be-muted",children:["· ",c.length," pending"]})]}),(0,b.jsx)("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-3",children:c.map(a=>(0,b.jsxs)("div",{className:"overflow-hidden rounded-md border border-be-border",children:[(0,b.jsx)("img",{src:a.url,alt:"",className:"aspect-square w-full object-cover"}),(0,b.jsxs)("div",{className:"p-2",children:[(0,b.jsx)("p",{className:"truncate text-xs text-be-muted",children:a.creditName?a.creditUrl?(0,b.jsxs)("a",{href:a.creditUrl,target:"_blank",rel:"noopener noreferrer",className:"hover:underline",children:["📷 ",a.creditName]}):(0,b.jsxs)(b.Fragment,{children:["📷 ",a.creditName]}):"No credit"}),(0,b.jsxs)("div",{className:"mt-2 flex gap-2",children:[(0,b.jsx)("button",{onClick:()=>n(a,!0),disabled:j===a.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,b.jsx)("button",{onClick:()=>n(a,!1),disabled:j===a.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"})]})]})]},a.id))})]},a))]})}])}];

//# sourceMappingURL=src_app_admin_gallery_submissions_submissions-review_tsx_1tq4iua._.js.map