PageSourceSearch

https://popcorn.hr/assets/admin.today-queue-XFHILart.js

js popcorn.hr collected 2026-10-02 14:19:33 UTC 4,558 bytes, 1 lines download raw bytes

1import{ah as N,r as i,j as e,L as p,s as y,t as c}from"./index-BTz-t5TX.js";import{T as k}from"./today-person-modal-DBj_zils.js";import{A as w}from"./arrow-left-DDPSc2Gw.js";import{C as P}from"./calendar-days-C1SGJquk.js";import{R as _}from"./refresh-cw-CTHc3a5Y.js";import"./dialog-D457rCc2.js";import"./x-C-8lclfT.js";import"./wand-sparkles-D8RtdfPK.js";function T(){const{canPublishArticles:a,loading:r}=N(),[o,t]=i.useState([]),[j,m]=i.useState(!0),[d,u]=i.useState(!1),[v,l]=i.useState(null),x=async()=>{m(!0);const{data:s}=await y.from("today_in_history").select("*");t(s??[]),m(!1)};i.useEffect(()=>{!r&&a&&x()},[r,a]);const b=async()=>{u(!0);try{const n=await(await fetch("/api/public/hooks/today-in-history",{method:"POST"})).json();n.ok?(c.success(`Povučeno: ${n.births} rođenih, ${n.deaths} umrlih.`),await x()):c.error(n.error||"Greška pri dohvatu.")}catch(s){c.error(s instanceof Error?s.message:"Greška pri dohvatu.")}u(!1)};if(r)return e.jsx("div",{className:"p-20 text-center text-muted-foreground",children:"Učitavanje…"});if(!a)return e.jsxs("div",{className:"mx-auto max-w-md p-20 text-center",children:[e.jsx("h1",{className:"font-serif text-3xl text-foreground",children:"Pristup odbijen"}),e.jsx("p",{className:"mt-3 text-muted-foreground",children:"Pregled je dostupan urednicima i administratorima."}),e.jsx(p,{to:"/",className:"mt-6 inline-block rounded-full bg-primary px-5 py-2 text-sm text-primary-foreground",children:"Početna"})]});const f=o.filter(s=>s.event_type==="birth"),h=o.filter(s=>s.event_type==="death");return e.jsxs("div",{className:"mx-auto max-w-6xl px-6 py-12",children:[e.jsxs(p,{to:"/admin",className:"inline-flex items-center gap-2 text-sm font-medium text-muted-foreground hover:text-foreground",children:[e.jsx(w,{className:"size-4"})," Natrag u administraciju"]}),e.jsxs("div",{className:"mt-6 flex flex-wrap items-end justify-between gap-4",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"inline-flex items-center gap-2 rounded-full border border-primary/40 bg-primary/10 px-3 py-1 text-xs font-semibold uppercase tracking-widest text-primary",children:[e.jsx(P,{className:"size-3.5"})," Pregled na današnji dan"]}),e.jsx("h1",{className:"mt-3 font-serif text-4xl text-foreground",children:"Povučene osobe"}),e.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Automatski dohvat svaki dan u 00:00. Ako dohvat nije uspio, povucite osobe ponovno."})]}),e.jsxs("button",{onClick:b,disabled:d,className:"inline-flex items-center gap-2 rounded-full bg-surface-elevated px-4 py-2 text-sm font-medium text-foreground ring-1 ring-border disabled:opacity-50",children:[e.jsx(_,{className:`size-4 ${d?"animate-spin":""}`})," ",d?"Dohvat...":"Povuci ponovno"]})]}),j?e.jsx("div",{className:"mt-10 text-center text-muted-foreground",children:"Učitavanje…"}):o.length===0?e.jsx("div",{className:"mt-8 rounded-lg border border-dashed border-border bg-surface p-12 text-center text-muted-foreground",children:'Nema povučenih osoba. Kliknite "Povuci ponovno".'}):e.jsxs("div",{className:"mt-8 space-y-10",children:[e.jsx(g,{title:`Rođeni (${f.length})`,rows:f,onSelect:l}),e.jsx(g,{title:`Umrli (${h.length})`,rows:h,onSelect:l})]}),e.jsx(k,{person:v,onClose:()=>l(null)})]})}function g({title:a,rows:r,onSelect:o}){return r.length===0?null:e.jsxs("section",{children:[e.jsx("h2",{className:"mb-4 font-serif text-2xl text-foreground",children:a}),e.jsx("div",{className:"divide-y divide-border overflow-hidden rounded-lg border border-border bg-surface",children:r.map(t=>e.jsxs("button",{type:"button",onClick:()=>o(t),className:"flex w-full items-center gap-4 p-4 text-left transition hover:bg-surface-elevated",children:[e.jsx("div",{className:"size-14 shrink-0 overflow-hidden rounded bg-surface-elevated",children:t.photo_url?e.jsx("img",{src:t.photo_url,alt:t.full_name,className:"size-full object-cover",loading:"lazy"}):e.jsx("div",{className:"flex size-full items-center justify-center text-[9px] text-muted-foreground",children:"Bez slike"})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:"truncate font-medium text-foreground",children:t.full_name}),e.jsx("p",{className:"truncate text-xs text-muted-foreground",children:t.profession||"—"})]}),e.jsxs("div",{className:"shrink-0 text-right text-xs text-muted-foreground",children:[e.jsx("div",{children:t.birth_date||t.death_date?new Date(t.birth_date||t.death_date).getFullYear()+".":"—"}),e.jsxs("div",{children:[t.sitelinks??0," sitelinkova"]})]})]},t.id))})]})}export{T as component};

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.