PageSourceSearch

https://aceaispark.com/assets/ContentGallery-qrYe_Bk1.js

js aceaispark.com collected 2026-09-29 01:11:29 UTC 11,087 bytes, 1 lines download raw bytes

1import{j as e}from"./query-DsCa_Pyl.js";import{r}from"./react-vendor-BCqHlMf_.js";import{W as K,Y as Q,_ as $,B as u,X as ee,H as se,a7 as T,a8 as G,a9 as R,s as te,d as ae,e as re,h as le,i as ne,g as oe,a0 as U,b as B,aa as ie,V as ce,I as de}from"./index-DTOh3Yy2.js";import{S as k,a as _,b as S,c as L,d as i}from"./select-B3rz7HZT.js";import{B as b}from"./badge-Dx1KjImI.js";import{V as he}from"./index-Dv3aFK8H.js";import{C as me}from"./chevron-left-Kw6hBpoU.js";import{D as xe}from"./download-Czzde3bo.js";import{L as ue}from"./lock-Bu63kIFT.js";import{E as je}from"./eye-off-KAtI5AYD.js";import{E as fe}from"./eye-m3IWzlod.js";import{P as ge}from"./play-BXAgQeij.js";import"./supabase-Bj-H2d61.js";import"./recharts-g6Jqsn6E.js";import"./framer-yhwvsixF.js";import"./tiptap-B6mHXrL0.js";function pe({open:s,onOpenChange:d,items:l,index:n,onIndexChange:m}){var g;const a=l[n],j=r.useCallback(()=>{l.length&&m(n<l.length-1?n+1:0)},[n,l.length,m]),f=r.useCallback(()=>{l.length&&m(n>0?n-1:l.length-1)},[n,l.length,m]);if(r.useEffect(()=>{if(!s)return;const x=w=>{w.key==="ArrowLeft"&&f(),w.key==="ArrowRight"&&j()};return window.addEventListener("keydown",x),()=>window.removeEventListener("keydown",x)},[s,f,j]),!a)return null;const E=(a.user_name||a.user_email||"?").slice(0,2).toUpperCase();return e.jsx(K,{open:s,onOpenChange:d,children:e.jsxs(Q,{className:"max-w-[95vw] max-h-[95vh] w-[95vw] h-[95vh] p-0 overflow-hidden bg-background border",hideCloseButton:!0,children:[e.jsx(he,{children:e.jsx($,{children:"Content viewer"})}),e.jsxs("div",{className:"flex w-full h-full",children:[e.jsxs("div",{className:"relative flex-1 bg-black/95 flex items-center justify-center",children:[e.jsx(u,{variant:"ghost",size:"icon",className:"absolute top-3 right-3 z-10 text-white hover:bg-white/20",onClick:()=>d(!1),children:e.jsx(ee,{className:"w-5 h-5"})}),l.length>1&&e.jsxs(e.Fragment,{children:[e.jsx(u,{variant:"ghost",size:"icon",className:"absolute left-2 top-1/2 -translate-y-1/2 z-10 text-white hover:bg-white/20 h-12 w-12",onClick:f,children:e.jsx(me,{className:"w-7 h-7"})}),e.jsx(u,{variant:"ghost",size:"icon",className:"absolute right-2 top-1/2 -translate-y-1/2 z-10 text-white hover:bg-white/20 h-12 w-12",onClick:j,children:e.jsx(se,{className:"w-7 h-7"})}),e.jsxs("div",{className:"absolute top-3 left-3 z-10 bg-black/60 text-white px-3 py-1 rounded-full text-sm",children:[n+1," / ",l.length]})]}),e.jsx(ve,{item:a})]}),e.jsxs("div",{className:"w-80 border-l bg-card overflow-y-auto p-5 space-y-5",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-semibold text-muted-foreground mb-2",children:"Created by"}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs(T,{className:"h-10 w-10",children:[e.jsx(G,{src:a.user_avatar??void 0}),e.jsx(R,{children:E})]}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"font-medium truncate",children:a.user_name??"Unknown user"}),e.jsx("p",{className:"text-xs text-muted-foreground truncate",children:a.user_email??a.user_id})]})]})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-semibold text-muted-foreground mb-2",children:"Source"}),e.jsx(b,{variant:"secondary",children:a.source==="video_generation"?"AI Video":a.source==="influencer_content"?"Influencer Content":"Media Upload"})]}),a.model&&e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-semibold text-muted-foreground mb-1",children:"Model"}),e.jsx("p",{className:"text-sm",children:a.model})]}),a.prompt&&e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-semibold text-muted-foreground mb-1",children:"Prompt"}),e.jsx("p",{className:"text-sm whitespace-pre-wrap break-words",children:a.prompt})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-semibold text-muted-foreground mb-1",children:"Created"}),e.jsx("p",{className:"text-sm",children:new Date(a.created_at).toLocaleString()})]}),((g=a.metadata)==null?void 0:g.file_size)&&e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-semibold text-muted-foreground mb-1",children:"File size"}),e.jsxs("p",{className:"text-sm",children:[(Number(a.metadata.file_size)/1024/1024).toFixed(2)," MB"]})]}),e.jsx("div",{className:"pt-2",children:e.jsx(u,{variant:"outline",size:"sm",className:"w-full",asChild:!0,children:e.jsxs("a",{href:a.url,download:!0,target:"_blank",rel:"noopener noreferrer",children:[e.jsx(xe,{className:"w-4 h-4 mr-2"}),"Download"]})})})]})]})]})})}function ve({item:s}){return s.type==="video"?e.jsx("video",{src:s.url,controls:!0,autoPlay:!0,className:"max-w-full max-h-full object-contain"},s.id):e.jsx("img",{src:s.url,alt:s.prompt??"Content",className:"max-w-full max-h-full object-contain"},s.id)}const be=50;function Ue(){const[s,d]=r.useState([]),[l,n]=r.useState(!1),[m,a]=r.useState(!1),[j,f]=r.useState(!1),[E,g]=r.useState(0),[x,w]=r.useState("all"),[N,H]=r.useState("30d"),[y,O]=r.useState("newest"),[p,q]=r.useState("all"),[I,W]=r.useState([]),[X,V]=r.useState(!1),[Y,D
1]=r.useState(0),[z,Z]=r.useState(!0),P=r.useCallback(async(t,A)=>{t===0?n(!0):a(!0);try{const{data:o,error:C}=await te.functions.invoke("admin-content-gallery",{body:{contentType:x,userIdFilter:p==="all"?null:p,dateRange:N,sort:y,limit:be,offset:t}});if(C)throw C;const h=(o==null?void 0:o.items)??[];d(v=>A?[...v,...h]:h),f(!!(o!=null&&o.hasMore)),g((o==null?void 0:o.total)??0),h.length>0&&W(v=>{const F=new Map(v.map(c=>[c.id,c.name]));for(const c of h)F.has(c.user_id)||F.set(c.user_id,c.user_name||c.user_email||c.user_id.slice(0,8));return[...F.entries()].map(([c,M])=>({id:c,name:M})).sort((c,M)=>c.name.localeCompare(M.name))})}catch(o){console.error("Gallery fetch error:",o)}finally{n(!1),a(!1)}},[x,N,y,p,I.length]);r.useEffect(()=>{P(0,!1)},[x,N,y,p]);const J=t=>{D(t),V(!0)};return e.jsxs(ae,{children:[e.jsxs(re,{children:[e.jsx("div",{className:"flex items-start justify-between gap-4 flex-wrap",children:e.jsxs("div",{children:[e.jsxs(le,{className:"flex items-center gap-2",children:[e.jsx(ue,{className:"w-5 h-5"}),"Content Gallery",e.jsx(b,{variant:"outline",className:"ml-2",children:"Admin only"})]}),e.jsx(ne,{children:"Private view of all user-generated content across the platform."})]})}),e.jsxs("div",{className:"flex flex-wrap gap-3 mt-4",children:[e.jsxs(k,{value:x,onValueChange:w,children:[e.jsx(_,{className:"w-[180px]",children:e.jsx(S,{})}),e.jsxs(L,{children:[e.jsx(i,{value:"all",children:"All content"}),e.jsx(i,{value:"videos",children:"Videos only"}),e.jsx(i,{value:"images",children:"Images only"}),e.jsx(i,{value:"influencer",children:"Influencer content"}),e.jsx(i,{value:"uploads",children:"Uploads"})]})]}),e.jsxs(k,{value:N,onValueChange:H,children:[e.jsx(_,{className:"w-[160px]",children:e.jsx(S,{})}),e.jsxs(L,{children:[e.jsx(i,{value:"7d",children:"Last 7 days"}),e.jsx(i,{value:"30d",children:"Last 30 days"}),e.jsx(i,{value:"90d",children:"Last 90 days"}),e.jsx(i,{value:"all",children:"All time"})]})]}),e.jsxs(k,{value:y,onValueChange:O,children:[e.jsx(_,{className:"w-[140px]",children:e.jsx(S,{})}),e.jsxs(L,{children:[e.jsx(i,{value:"newest",children:"Newest first"}),e.jsx(i,{value:"oldest",children:"Oldest first"})]})]}),I.length>0&&e.jsxs(k,{value:p,onValueChange:q,children:[e.jsx(_,{className:"w-[200px]",children:e.jsx(S,{placeholder:"All users"})}),e.jsxs(L,{children:[e.jsx(i,{value:"all",children:"All users"}),I.map(t=>e.jsx(i,{value:t.id,children:t.name},t.id))]})]}),e.jsxs(u,{variant:"outline",size:"sm",className:"h-10",onClick:()=>Z(t=>!t),title:"User content can be explicit — previews are blurred by default. Click an item to view it.",children:[z?e.jsx(je,{className:"w-4 h-4 mr-2"}):e.jsx(fe,{className:"w-4 h-4 mr-2"}),z?"Previews blurred":"Previews visible"]})]})]}),e.jsx(oe,{children:l?e.jsx("div",{className:"flex items-center justify-center py-20",children:e.jsx(U,{className:"w-6 h-6 animate-spin text-muted-foreground"})}):s.length===0?e.jsx("div",{className:"text-center py-20 text-muted-foreground",children:"No content found for the selected filters."}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"text-sm text-muted-foreground mb-3",children:["Showing ",s.length," of ",E," items"]}),e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-3",children:s.map((t,A)=>{const o=(t.user_name||t.user_email||"?").slice(0,2).toUpperCase(),C=()=>{d(h=>h.filter(v=>v.id!==t.id)),g(h=>Math.max(0,h-1))};return e.jsxs("button",{onClick:()=>J(A),className:"group relative aspect-square rounded-lg overflow-hidden bg-muted border border-border hover:border-primary transition-all hover:shadow-lg text-left",children:[e.jsx("div",{className:z?"absolute inset-0 blur-2xl scale-110":"absolute inset-0",children:e.jsx(we,{item:t,onBroken:C})}),e.jsxs(b,{className:"absolute top-2 right-2 bg-black/70 text-white border-none text-xs",children:[t.source==="video_generation"&&e.jsx(B,{className:"w-3 h-3"}),t.source==="influencer_content"&&e.jsx(B,{className:"w-3 h-3"}),t.source==="media_library"&&e.jsx(ie,{className:"w-3 h-3"})]}),e.jsxs("div",{className:"absolute bottom-0 left-0 right-0 bg-gradient-to-t from-black/80 to-transparent p-2 flex items-center gap-2",children:[e.jsxs(T,{className:"h-6 w-6 border border-white/30",children:[e.jsx(G,{src:t.user_avatar??void 0}),e.jsx(R,{className:"text-[10px]",children:o})]}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:"text-xs text-white font-medium truncate",children:t.user_name??t.user_email??"Unknown"}),e.jsx("p",{className:"text-[10px] text-white/70 truncate",children:new Date(t.created_at).toLocaleDateString()})]})]})]},t.id)})}),j&&e.jsx("div",{className:"flex justify-center mt-6",children:e.jsx(u,{variant:"outline",onClick:()=>P(s.length,!0),disabled:m,children:m?e.jsxs(e.Fragment,{children:[e.jsx(U,{className:"w-4 h-4 mr-2 animate-spin"}),"Loading..."]}):e.jsx(e.Fragment,{children:"Load 50 more"})})})]})}),e.jsx(pe,{open:X,onOpenChange:V,items:s,index:Y,onIndexChange:D})]})}function we({item:s,onBroken:d}){const[l,n]=r.useState(!1);return s.type==="video"?e.jsxs(e.Fragment,{children:[s.thumbnail_url&&!l?e.jsx("img",{src:s.thumbnail_url,alt:"",className:"w-full h-full object-cover group-hover:scale-105 transition-transform",onError:()=>n(!0)}):e.jsx("video",{src:s.url,className:"w-full h-full object-cover",preload:"metadata",muted:!0,playsInl
1ine:!0,onError:d}),e.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-black/30 opacity-0 group-hover:opacity-100 transition-opacity",children:e.jsx(ge,{className:"w-12 h-12 text-white drop-shadow-lg",fill:"white"})}),e.jsxs(b,{className:"absolute top-2 left-2 bg-black/70 text-white border-none text-xs",children:[e.jsx(ce,{className:"w-3 h-3 mr-1"}),"Video"]})]}):e.jsxs(e.Fragment,{children:[e.jsx("img",{src:s.url,alt:s.prompt??"",className:"w-full h-full object-cover group-hover:scale-105 transition-transform",loading:"lazy",onError:d}),e.jsxs(b,{className:"absolute top-2 left-2 bg-black/70 text-white border-none text-xs",children:[e.jsx(de,{className:"w-3 h-3 mr-1"}),"Image"]})]})}export{Ue as ContentGallery};

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.