PageSourceSearch

https://myechoboard.com/assets/AdminBoards-D73YYf73.js

js myechoboard.com collected 2026-10-02 00:19:58 UTC 7,273 bytes, 1 lines download raw bytes

1import{r as e,j as s}from"./vendor-react-BfgFmtGS.js";import{MainLayout as r}from"./MainLayout-B-JwvN1-.js";import{PageHeader as a}from"./PageHeader-BnvONm3p.js";import{B as t}from"./button-CYJdLL_L.js";import{I as d}from"./input-Cv-gXlbe.js";import{B as l}from"./badge-Cd6jhgwG.js";import{a as n,u as i}from"./useAuth-DynbexoK.js";import{supabase as o}from"./supabase-client-2CObC91N.js";import{A as m,h as c,a as x,b as u,c as p,d as h,e as j,f,g}from"./alert-dialog-DEiWzkJW.js";import{d as b,L as w}from"./vendor-router-QOYqHwMx.js";import{A as N}from"./arrow-left-DAvP91ch.js";import{S as v}from"./search-D_LVchoc.js";import{L as y}from"./loader-circle-fXsKc0TP.js";import{L as _}from"./layers-3-497JDkty.js";import{L as S}from"./lock-D3L7n1Hp.js";import{G as A}from"./globe-xPKErxGR.js";import{E as L}from"./eye-off-YQaMGNXO.js";import{F as k}from"./flame-DueLJnbo.js";import{U as C}from"./user-Ds9XOBLy.js";import{S as B}from"./shield-CoYdFdVE.js";import{f as T}from"./vendor-date-CJZoUMEw.js";import{E as z}from"./eye-CImpNXgw.js";import{C as D}from"./chevron-right-aaxqAI6v.js";import{T as E}from"./trash-2-CLE9ZDje.js";function F(){const{isAdmin:F,isLoading:M}=n(),{toast:$}=i(),[P,U]=e.useState(""),[H,O]=e.useState([]),[Y,q]=e.useState(0),[G,I]=e.useState(!0),[J,R]=e.useState(!1),[Z,K]=e.useState(!1),[Q,V]=e.useState(null),W=e.useMemo(()=>P.trim(),[P]),X=async(e,s)=>{s?K(!0):R(!0);try{const{data:r,error:a}=await o.rpc("admin_get_boards_recent",{p_search_query:W||null,p_limit:40,p_offset:e});if(a)throw a;const t=r||[];O(e=>s?[...e,...t]:t),q(e),I(40===t.length)}catch(r){$({title:"Failed to load boards",description:r.message,variant:"error"})}finally{R(!1),K(!1)}};return e.useEffect(()=>{if(!F)return;const e=window.setTimeout(()=>{X(0,!1)},200);return()=>window.clearTimeout(e)},[F,W]),M?null:F?s.jsx(r,{children:s.jsxs("div",{className:"max-w-7xl mx-auto p-6 space-y-6",children:[s.jsx(a,{title:"Admin Boards",description:"All site boards ordered by latest updated, including private ones.",rightAction:s.jsx(w,{to:"/admin",children:s.jsxs(t,{variant:"outline",size:"sm",className:"rounded-xl gap-2",children:[s.jsx(N,{className:"w-4 h-4"}),"Admin"]})})}),s.jsx("div",{className:"rounded-[2rem] border border-border/50 bg-card/60 backdrop-blur-xl p-5 shadow-soft",children:s.jsxs("div",{className:"flex flex-col gap-4 md:flex-row md:items-center md:justify-between",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-semibold text-foreground",children:"Moderation board index"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Search by board name or owner, then open any board on an admin-only viewer."})]}),s.jsxs("div",{className:"relative w-full md:max-w-sm",children:[s.jsx(v,{className:"w-4 h-4 text-muted-foreground absolute left-3 top-1/2 -translate-y-1/2"}),s.jsx(d,{value:P,onChange:e=>U(e.target.value),placeholder:"Search boards or owners",className:"pl-9 rounded-xl"})]})]})}),s.jsx("div",{className:"space-y-4",children:J?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(y,{className:"w-5 h-5 animate-spin"}),"Loading boards…"]}):0===H.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:"No boards found"}),s.jsx("p",{className:"text-sm text-muted-foreground mt-2",children:"Try a different search term."})]}):H.map(e=>{const r=e.owner_username?`@${e.owner_username}`:e.owner_full_name||"Unknown owner";return s.jsx("div",{className:"rounded-[2rem] border border-border/50 bg-card/60 backdrop-blur-xl p-5 shadow-soft",children:s.jsxs("div",{className:"flex flex-col gap-4 lg:flex-row lg:items-start lg:justify-between",children:[s.jsxs("div",{className:"min-w-0 space-y-3",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsxs("div",{className:"inline-flex items-center gap-2 rounded-xl bg-primary/8 px-3 py-1.5 text-sm font-semibold text-primary",children:[s.jsx(_,{className:"w-4 h-4"}),s.jsx("span",{className:"truncate max-w-[16rem]",children:e.name})]}),e.is_private?s.jsxs(l,{variant:"secondary",className:"gap-1",children:[s.jsx(S,{className:"w-3 h-3"}),"Private"]}):s.jsxs(l,{variant:"secondary",className:"gap-1",children:[s.jsx(A,{className:"w-3 h-3"}),"Public"]}),e.is_hidden?s.jsxs(l,{variant:"outline",className:"gap-1",children:[s.jsx(L,{className:"w-3 h-3"}),"Hidden"]}):null,e.is_mature?s.jsxs(l,{variant:"outline",className:"gap-1",children:[s.jsx(k,{className:"w-3 h-3"}),"Mature"]}):null]}),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(C,{className:"w-4 h-4"}),e.owner_full_name||r,e.owner_username?s.jsx("span",{className:"text-primary",children:r}):null]}),s.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[s.jsx(B,{className:"w-4 h-4"}),e.memory_count||0," ",1===e.memory_count?"echo":"echoes"]}),s.jsxs("span",{children:["Updated ",T(new Date(e.updated_at),{addSuffix:!0})]})]}
1),e.description?s.jsx("p",{className:"text-sm text-foreground/85 leading-relaxed max-w-3xl",children:e.description}):null]}),s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.owner_username?s.jsx(w,{to:`/u/${e.owner_username}`,target:"_blank",children:s.jsxs(t,{variant:"outline",size:"sm",className:"rounded-xl gap-2",children:[s.jsx(C,{className:"w-4 h-4"}),"Owner"]})}):null,s.jsx(w,{to:`/admin/boards/${e.id}`,children:s.jsxs(t,{size:"sm",className:"rounded-xl gap-2",children:[s.jsx(z,{className:"w-4 h-4"}),"Open Board",s.jsx(D,{className:"w-4 h-4"})]})}),s.jsxs(m,{children:[s.jsx(c,{asChild:!0,children:s.jsxs(t,{variant:"outline",size:"sm",className:"rounded-xl gap-2 border-destructive/30 text-destructive hover:bg-destructive/10",disabled:Q===e.id,children:[Q===e.id?s.jsx(y,{className:"w-4 h-4 animate-spin"}):s.jsx(E,{className:"w-4 h-4"}),"Delete Board"]})}),s.jsxs(x,{className:"rounded-[2rem]",children:[s.jsxs(u,{children:[s.jsx(p,{children:"Delete board?"}),s.jsxs(h,{children:['This permanently deletes "',e.name,'" from Echo. The board will be removed for everyone, including the owner.']})]}),s.jsxs(j,{children:[s.jsx(f,{className:"rounded-xl",children:"Cancel"}),s.jsx(g,{className:"rounded-xl bg-destructive text-destructive-foreground hover:bg-destructive/90",onClick:()=>{(async e=>{V(e.id);try{const{error:s}=await o.rpc("admin_delete_board",{p_board_id:e.id});if(s)throw s;O(s=>s.filter(s=>s.id!==e.id)),I(e=>e),$({title:"Board deleted",description:`"${e.name}" has been permanently deleted.`})}catch(s){$({title:"Failed to delete board",description:s.message,variant:"error"})}finally{V(null)}})(e)},children:"Delete permanently"})]})]})]})]})]})},e.id)})}),H.length>0&&G?s.jsx("div",{className:"flex justify-center pt-2",children:s.jsx(t,{variant:"outline",className:"rounded-xl",disabled:Z,onClick:()=>{X(Y+40,!0)},children:Z?s.jsxs(s.Fragment,{children:[s.jsx(y,{className:"w-4 h-4 mr-2 animate-spin"}),"Loading…"]}):"Load more boards"})}):null]})}):s.jsx(b,{to:"/",replace:!0})}export{F 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.