PageSourceSearch

https://www.oic-ac.org/assets/Photos-D7jCEJLE.js

js oic-ac.org collected 2026-10-07 07:24:33 UTC 3,040 bytes, 1 lines download raw bytes

1import{j as s,a as x}from"./index-RRwfZ9PE.js";import{e as L,b as a,L as _}from"./vendor-D7T0SJZ8.js";import{r as w}from"./media-DCKQn7HP.js";import{P as E,T as $,C as D}from"./ConfirmDialog-Bt3x00u3.js";import{H as P,a as k,F as I,L as T,E as A}from"./parts-DA1EMS_i.js";import{P as F}from"./plus-Blmfvbic.js";import"./createLucideIcon-nM--CQPV.js";const f={library:"Library",person:"People"};function O(){const c=L(),[l,g]=a.useState([]),[j,d]=a.useState(!0),[r,b]=a.useState(""),[m,y]=a.useState(""),[h,S]=a.useState(""),[o,n]=a.useState(null);function p(){d(!0),x.get("/admin/photos/usage").then(e=>g(e.data)).catch(console.error).finally(()=>d(!1))}a.useEffect(()=>{p()},[]);const i=a.useMemo(()=>{const e=h.trim().toLowerCase();return l.filter(t=>!(r&&t.type!==r||e&&!`${t.title||""} ${t.context||""}`.toLowerCase().includes(e)))},[l,r,h]);async function N(){var e,t;try{await x.delete(`/admin/photos/${o.photoId}`),n(null),p()}catch(C){alert(((t=(e=C.response)==null?void 0:e.data)==null?void 0:t.error)||"Failed to delete")}}function u(e){e.type==="library"?c(`/admin/photos/${e.photoId}/edit`):e.type==="person"&&c(`/admin/people/members/${e.memberId}/edit`)}const v=Array.from(new Set(l.map(e=>e.type)));return s.jsxs("section",{children:[s.jsxs("div",{className:"ed-head",children:[s.jsx("div",{children:s.jsx("h1",{className:"ed-head__h1",children:"Photos"})}),s.jsx(P,{value:m,onChange:y,onSubmit:()=>S(m),placeholder:"Search images…"}),s.jsx("div",{className:"ed-head__actions",children:s.jsxs(_,{to:"/admin/photos/new",className:"ed-btn ed-btn--primary",children:[s.jsx(F,{size:16})," Upload"]})})]}),s.jsx(k,{count:i.length,countLabel:"images",children:s.jsx(I,{label:"Source",options:[{value:"",label:"All sources"},...v.map(e=>({value:e,label:f[e]||e}))],value:r,onChange:b})}),j?s.jsx(T,{}):i.length===0?s.jsx(A,{message:"No images found."}):s.jsx("div",{className:"ed-photo-grid",children:i.map(e=>s.jsxs("figure",{className:"ed-photo",children:[s.jsx("div",{className:"ed-photo__thumb",style:{backgroundImage:`url(${w(e.src)})`},role:"img","aria-label":e.title,onClick:()=>u(e)}),s.jsxs("div",{className:"ed-row-actions",children:[s.jsx("button",{type:"button",className:"ed-icon-btn",onClick:()=>u(e),"aria-label":"Edit",children:s.jsx(E,{})}),e.type==="library"&&s.jsx("button",{type:"button",className:"ed-icon-btn is-danger",onClick:()=>n(e),"aria-label":"Delete",children:s.jsx($,{})})]}),s.jsxs("figcaption",{className:"ed-photo__meta",children:[s.jsx("h3",{children:e.title}),s.jsx("p",{className:"ed-photo__where",children:e.context}),s.jsxs("p",{className:"ed-photo__dims",children:[s.jsx("span",{className:`ed-src-tag ed-src-tag--${e.type}`,children:f[e.type]||e.type}),e.width&&e.height?s.jsxs("span",{children:[" · ",e.width," × ",e.height]}):null]})]})]},e.key))}),s.jsx(D,{open:!!o,title:"Delete image",message:`Delete "${(o==null?void 0:o.title)||""}" from the library? The file is removed from the server.`,confirmLabel:"Delete",danger:!0,onConfirm:N,onCancel:()=>n(null)})]})}export{O 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.