PageSourceSearch

https://myechoboard.com/assets/AdminBoardDetail-H0cLyOBT.js

js myechoboard.com collected 2026-09-24 13:49:35 UTC 8,270 bytes, 1 lines download raw bytes

1import{r as e,j as s}from"./vendor-react-C9yDzYQD.js";import{MainLayout as r}from"./MainLayout-SlmExmjp.js";import{PageHeader as a}from"./PageHeader-Dt7JKE_V.js";import{B as l}from"./button-CcIRk75H.js";import{D as n,a as t,b as o,c as d,d as i}from"./dialog-DHNNRuDw.js";import{B as c}from"./badge-Dri1da3C.js";import{M as m}from"./MemoryCard-DJDOd9Hn.js";import{a as x,u}from"./useAuth-Dz3EPsxs.js";import{supabase as p}from"./supabase-client-_h80EYw_.js";import{g as h}from"./safeExternalUrl-Hy3HQFqY.js";import{d as j,b as f,L as g}from"./vendor-router-X7RJKav4.js";import{A as _}from"./arrow-left-B8V7NEG8.js";import{L as b}from"./loader-circle-CWK_zhHB.js";import{L as w}from"./lock-Dh-2FzOx.js";import{G as N}from"./globe-DJqDK8z8.js";import{U as v}from"./user-DrHqDh0A.js";import{C as y}from"./calendar-BcnXqNLJ.js";import{f as k,a as L}from"./vendor-date-D4HAbvGT.js";import{E as P}from"./external-link-n2tXYKjz.js";import{L as O}from"./link-2-6cCY8DT2.js";import{P as S}from"./play-DCyyoljT.js";function A({memory:e,isOpen:r,onOpenChange:a}){if(!e)return null;const l=e.title||e.description||"Echo preview";return s.jsx(n,{open:r,onOpenChange:a,children:s.jsxs(t,{className:"max-w-3xl rounded-[2rem] max-h-[90vh] overflow-y-auto",children:[s.jsxs(o,{children:[s.jsx(d,{children:l}),s.jsx(i,{children:e.added_by_username?`Added by @${e.added_by_username}`:"Board echo preview"})]}),s.jsxs("div",{className:"space-y-4",children:["image"===e.type&&e.image_url?s.jsx("img",{src:e.image_url,alt:e.title||"",className:"w-full rounded-2xl object-cover"}):null,"video"===e.type&&e.video_url?s.jsx("video",{src:e.video_url,controls:!0,className:"w-full rounded-2xl"}):null,"audio"===e.type&&e.audio_url?s.jsx("audio",{src:e.audio_url,controls:!0,className:"w-full"}):null,"url"===e.type&&h(e.source_url)?s.jsxs("a",{href:h(e.source_url)||void 0,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-2 text-primary hover:underline",children:[s.jsx(P,{className:"w-4 h-4"}),"Open source"]}):null,e.description?s.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed",children:e.description}):null,e.content?s.jsx("div",{className:"rounded-2xl border border-border/50 bg-muted/30 p-4 whitespace-pre-wrap break-words text-sm leading-relaxed",children:e.content}):null,s.jsxs("div",{className:"flex flex-wrap items-center gap-3 text-xs text-muted-foreground",children:[s.jsx("span",{children:e.type}),s.jsx("span",{children:L(new Date(e.created_at),"PPP p")}),e.added_by_username?s.jsxs("span",{children:["@",e.added_by_username]}):null]})]})]})})}function C(){const{boardId:n}=j(),{isAdmin:t,isLoading:o}=x(),{toast:d}=u(),[i,L]=e.useState(null),[C,U]=e.useState([]),[B,$]=e.useState(!0),[F,M]=e.useState(!1),[z,D]=e.useState(!0),[E,I]=e.useState(null),V=e.useMemo(()=>i?i.owner_username?`@${i.owner_username}`:i.owner_full_name||"Unknown owner":"Unknown owner",[i]);return e.useEffect(()=>{t&&n&&(async()=>{$(!0);try{const[{data:e,error:s},{data:r,error:a}]=await Promise.all([p.rpc("admin_get_board_for_moderation",{p_board_id:n}),p.rpc("admin_get_board_memories_paginated",{p_board_id:n,p_limit:60,p_offset:0})]);if(s)throw s;if(a)throw a;const l=(e||[])[0];if(!l)return L(null),U([]),void D(!1);L(l),U(r||[]),D(60===(r||[]).length)}catch(e){d({title:"Failed to load board",description:e.message,variant:"error"})}finally{$(!1)}})()},[t,n,d]),o?null:t?s.jsx(r,{children:s.jsxs("div",{className:"max-w-7xl mx-auto p-6 space-y-6",children:[s.jsx(a,{title:"Admin Board View",description:"Moderator access to a board and its echoes.",rightAction:s.jsx(g,{to:"/admin/boards",children:s.jsxs(l,{variant:"outline",size:"sm",className:"rounded-xl gap-2",children:[s.jsx(_,{className:"w-4 h-4"}),"All Boards"]})})}),B?s.jsxs("div",{className:"rounded-[2rem] border border-border/50 bg-card/60 p-10 flex items-center justify-center gap-3 text-muted-foreground",children:[s.jsx(b,{className:"w-5 h-5 animate-spin"}),"Loading board…"]}):i?s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"rounded-[2rem] border border-border/50 bg-card/60 backdrop-blur-xl overflow-hidden shadow-soft",children:[i.header_image_url?s.jsx("div",{className:"h-44 w-full bg-cover bg-center",style:{backgroundImage:`url(${i.header_image_url})`}}
1):null,s.jsx("div",{className:"p-6 space-y-4",children:s.jsxs("div",{className:"flex flex-col gap-4 lg:flex-row lg:items-start lg:justify-between",children:[s.jsxs("div",{className:"space-y-3 min-w-0",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx("h1",{className:"text-2xl font-black text-foreground truncate",children:i.name}),i.is_private?s.jsxs(c,{variant:"secondary",className:"gap-1",children:[s.jsx(w,{className:"w-3 h-3"}),"Private"]}):s.jsxs(c,{variant:"secondary",className:"gap-1",children:[s.jsx(N,{className:"w-3 h-3"}),"Public"]})]}),s.jsxs("div",{className:"flex flex-wrap items-center gap-x-4 gap-y-2 text-sm text-muted-foreground",children:[s.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[s.jsx(v,{className:"w-4 h-4"}),i.owner_full_name||V,i.owner_username?s.jsx("span",{className:"text-primary",children:V}):null]}),s.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[s.jsx(y,{className:"w-4 h-4"}),"Updated ",k(new Date(i.updated_at),{addSuffix:!0})]}),s.jsxs("span",{children:[i.memory_count||0," ",1===i.memory_count?"echo":"echoes"]})]}),i.description?s.jsx("p",{className:"text-sm text-foreground/85 leading-relaxed max-w-3xl",children:i.description}):null]}),s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[i.owner_username?s.jsx(g,{to:`/u/${i.owner_username}`,target:"_blank",children:s.jsxs(l,{variant:"outline",size:"sm",className:"rounded-xl gap-2",children:[s.jsx(v,{className:"w-4 h-4"}),"Owner Profile"]})}):null,i.slug&&i.owner_username?s.jsx(g,{to:`/u/${i.owner_username}/${i.slug}`,target:"_blank",children:s.jsxs(l,{variant:"outline",size:"sm",className:"rounded-xl gap-2",children:[s.jsx(P,{className:"w-4 h-4"}),"Public Route"]})}):null]})]})})]}),s.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 xl:grid-cols-3 gap-5",children:C.map((e,r)=>s.jsxs("div",{className:"space-y-2",children:[s.jsx(m,{memory:e,index:r,allowUnsupportedLegacy:!0,onClick:()=>I(e),isReadOnly:!0,mobileView:"grid",priority:r<6}),s.jsxs("div",{className:"px-1 flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-muted-foreground",children:[e.added_by_username?s.jsxs("span",{className:"inline-flex items-center gap-1",children:[s.jsx(v,{className:"w-3 h-3"}),"@",e.added_by_username]}):null,h(e.source_url)?s.jsxs("a",{href:h(e.source_url)||void 0,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1 hover:text-primary",children:[s.jsx(O,{className:"w-3 h-3"}),"Source"]}):null,"video"===e.type?s.jsxs("span",{className:"inline-flex items-center gap-1",children:[s.jsx(S,{className:"w-3 h-3"}),"Video"]}):null]})]},e.id))}),0===C.length?s.jsxs("div",{className:"rounded-[2rem] border border-dashed border-border/60 bg-card/40 p-10 text-center",children:[s.jsx("p",{className:"text-lg font-semibold text-foreground",children:"This board has no echoes"}),s.jsx("p",{className:"text-sm text-muted-foreground mt-2",children:"Nothing to moderate here yet."})]}):null,z?s.jsx("div",{className:"flex justify-center pt-2",children:s.jsx(l,{variant:"outline",className:"rounded-xl",disabled:F,onClick:()=>{(async()=>{if(n&&!F&&z){M(!0);try{const{data:e,error:s}=await p.rpc("admin_get_board_memories_paginated",{p_board_id:n,p_limit:60,p_offset:C.length});if(s)throw s;const r=e||[];U(e=>[...e,...r]),D(60===r.length)}catch(e){d({title:"Failed to load more echoes",description:e.message,variant:"error"})}finally{M(!1)}}})()},children:F?s.jsxs(s.Fragment,{children:[s.jsx(b,{className:"w-4 h-4 mr-2 animate-spin"}),"Loading…"]}):"Load more echoes"})}):null]}):s.jsxs("div",{className:"rounded-[2rem] border border-dashed border-border/60 bg-card/40 p-10 text-center",children:[s.jsx("p",{className:"text-lg font-semibold text-foreground",children:"Board not found"}),s.jsx("p",{className:"text-sm text-muted-foreground mt-2",children:"It may have been deleted."})]}),s.jsx(A,{memory:E,isOpen:!!E,onOpenChange:e=>!e&&I(null)})]})}):s.jsx(f,{to:"/",replace:!0})}export{C as default};

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.