PageSourceSearch

https://nap.ba/assets/entries/pages_admin_posts_index.CqHomhDq.js

js nap.ba collected 2026-10-02 11:17:09 UTC 11,628 bytes, 1 lines download raw bytes

1import{r as g,j as e,i as j,a as f,o as y}from"../chunks/chunk-iVMtP0gY.js";import{u as v}from"../chunks/chunk-MNdPfGR9.js";import{i as N}from"../chunks/chunk-DHjyLgJW.js";import"../chunks/chunk-CsS8qNMW.js";/* empty css                      */function S(a){return a>=1e3?`${(a/1e3).toFixed(a>=1e4?0:1).replace(".",",")}k`:a.toLocaleString("bs-BA")}function k(a){if(a==null)return"—";const r=Math.floor(a/60),n=a%60;return`${r}:${String(n).padStart(2,"0")}`}function d({text:a}){return e.jsxs("span",{className:"group relative inline-flex align-middle ml-1",children:[e.jsx("button",{type:"button",tabIndex:0,"aria-label":a,className:"w-3.5 h-3.5 rounded-full bg-gray-200 text-gray-500 text-[9px] font-bold leading-none flex items-center justify-center hover:bg-gray-300 focus:outline-none focus:ring-1 focus:ring-nap-blue/30",children:"?"}),e.jsx("span",{role:"tooltip",className:"pointer-events-none absolute z-20 right-0 top-full mt-1 w-[260px] rounded-md bg-gray-900 text-white text-[11px] font-normal normal-case tracking-normal leading-snug px-2.5 py-2 shadow-lg opacity-0 group-hover:opacity-100 group-focus-within:opacity-100 transition-opacity",children:a})]})}function w(a){const r={};for(const s of new Intl.DateTimeFormat("en-GB",{timeZone:"Europe/Sarajevo",day:"2-digit",month:"2-digit",year:"numeric",hour:"2-digit",minute:"2-digit",hour12:!1}).formatToParts(new Date(a)))s.type!=="literal"&&(r[s.type]=s.value);const n=r.hour==="24"?"00":r.hour;return`${r.day}. ${r.month}. ${r.year}. ${n}:${r.minute}`}function P(){const a=v(),[r,n]=g.useState(new Set),s=a.posts.filter(t=>!r.has(t.id)),[c,h]=g.useState(a.search||"");function i(t){const l=new URLSearchParams,o=t.page??a.page,x=t.search!==void 0?t.search:a.search,p=t.status!==void 0?t.status:a.status;o>1&&l.set("page",String(o)),x&&l.set("search",x),p&&l.set("status",p);const u=l.toString();return`/admin/posts${u?`?${u}`:""}`}const m=async t=>{if(!confirm("Jeste li sigurni da želite obrisati ovu objavu?"))return;(await fetch(`/api/admin/posts/${t}`,{method:"DELETE"})).ok&&n(o=>new Set(o).add(t))},b=t=>{t.preventDefault(),typeof window<"u"&&(window.location.href=i({search:c,page:1}))};return e.jsxs("div",{children:[e.jsxs("div",{className:"mb-6 flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-xl font-black text-gray-900",children:"Objave"}),e.jsxs("p",{className:"text-sm text-gray-500 mt-1",children:[a.total," objava ukupno. Stranica ",a.page," od ",a.totalPages,"."]})]}),e.jsx("a",{href:"/admin/posts/new",className:"inline-flex items-center gap-2 px-4 py-2.5 bg-nap-blue text-white rounded-lg text-sm font-semibold hover:bg-nap-blue-dark transition-colors",children:"+ Nova objava"})]}),e.jsxs("div",{className:"flex gap-3 mb-4 flex-wrap",children:[e.jsxs("form",{onSubmit:b,className:"flex gap-2 flex-1 min-w-[200px] max-w-[400px]",children:[e.jsx("input",{type:"text",value:c,onChange:t=>h(t.target.value),placeholder:"Pretraži po naslovu, sadržaju ili tagu...",className:"flex-1 px-3 py-2 bg-gray-50 border border-gray-200 rounded-lg text-sm focus:border-nap-blue outline-none"}),e.jsx("button",{type:"submit",className:"px-3 py-2 bg-nap-blue text-white rounded-lg text-sm font-semibold hover:bg-nap-blue-dark",children:"Pretraži"})]}),e.jsx("div",{className:"flex gap-1",children:[{label:"Sve",value:""},{label:"Objavljeno",value:"published"},{label:"Nacrt",value:"draft"}].map(t=>e.jsx("a",{href:i({status:t.value,page:1}),className:`px-3 py-2 text-sm rounded-lg ${a.status===t.value?"bg-nap-blue text-white font-semibold":"bg-gray-50 border border-gray-200 text-gray-600 hover:bg-gray-100"}`,children:t.label},t.value))})]}),e.jsxs("div",{className:"bg-white rounded-xl border border-gray-200 overflow-hidden",children:[e.jsxs("table",{className:"w-full",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"bg-gray-50 border-b border-gray-200",children:[e.jsx("th",{className:"text-left px-4 py-3 text-[10px] font-bold text-gray-400 uppercase tracking-wider",children:"Naslov"}),e.jsx("th",{className:"text-left px-4 py-3 text-[10px] font-bold text-gray-400 uppercase tracking-wider hidden sm:table-cell",children:"Kategorija"}),e.jsx("th",{className:"text-left px-4 py-3 text-[10px] font-bold text-gray-400 uppercase tracking-wider hidden md:table-cell",children:"Autor"}),e.jsx("th",{className:"text-left px-4 py-3 text-[10px] font-bold text-gray-400 uppercase tracking-wider",children:"Status"}),e.jsxs("th",{className:"text-right px-4 py-3 text-[10px] font-bold text-gray-400 uppercase tracking-wider hidden md:table-cell",children:["Ogledi",e.
1jsx(d,{text:"Ukupan broj pregleda ove objave (od migracije). Broji svako učitavanje stranice. Bez filtra za botove, pa je vrijednost blago precijenjena."})]}),e.jsxs("th",{className:"text-right px-4 py-3 text-[10px] font-bold text-gray-400 uppercase tracking-wider hidden xl:table-cell",children:["Bralni čas",e.jsx(d,{text:"Prosječno aktivno vrijeme čitanja (mm:ss): od dolaska na objavu do napuštanja kartice. Svaki uzorak je ograničen na 30 min; ispod 3 s odbacujemo kao odskok. Praćenje teče tek od uvođenja — starije objave nemaju uzoraka."})]}),e.jsxs("th",{className:"text-right px-4 py-3 text-[10px] font-bold text-gray-400 uppercase tracking-wider hidden xl:table-cell",children:["Prebrano %",e.jsx(d,{text:"Prosjek najveće dubine skrolanja kroz sam tekst objave — koliko je od tijela teksta čitateljev pogled stvarno prešao. 100 % = kraj teksta je dosegao dno ekrana. Ne uračunava komentare ni podnožje stranice. Praćenje teče tek od uvođenja."})]}),e.jsxs("th",{className:"text-right px-4 py-3 text-[10px] font-bold text-gray-400 uppercase tracking-wider hidden xl:table-cell",children:["Globina strani",e.jsx(d,{text:"Prosjek najveće dubine skrolanja kroz cijelu stranicu — uključujući komentare i podnožje. 100 % = skrolano do kraja stranice. Tipično niže od »Prebrano %«, jer je tijelo teksta samo dio cijele stranice."})]}),e.jsx("th",{className:"text-right px-4 py-3 text-[10px] font-bold text-gray-400 uppercase tracking-wider",children:"Akcije"})]})}),e.jsx("tbody",{children:s.map(t=>e.jsxs("tr",{className:"border-b border-gray-50 hover:bg-gray-50/50",children:[e.jsxs("td",{className:"px-4 py-3",children:[e.jsx("a",{href:`/admin/posts/${t.slug}`,target:"_blank",rel:"noopener",className:"text-sm font-semibold text-gray-900 hover:text-nap-blue line-clamp-1",children:t.title}),e.jsx("div",{className:"text-[11px] text-gray-400 mt-0.5",children:w(t.publishDate)})]}),e.jsx("td",{className:"px-4 py-3 hidden sm:table-cell",children:t.categoryNames.length>0?e.jsx("div",{className:"flex flex-wrap gap-1",children:t.categoryNames.map(l=>e.jsx("span",{className:"inline-flex items-center text-[10px] font-semibold px-2 py-0.5 rounded-full bg-nap-blue-50 text-nap-blue border border-nap-blue/20",children:l},l))}):e.jsx("span",{className:"text-xs text-gray-500",children:"—"})}),e.jsx("td",{className:"px-4 py-3 hidden md:table-cell",children:e.jsx("span",{className:"text-xs text-gray-500",children:t.authorName||"Patria"})}),e.jsx("td",{className:"px-4 py-3",children:e.jsx("span",{className:`inline-flex items-center text-[11px] font-semibold px-2.5 py-1 rounded-full ${t.published?"bg-green-50 text-green-700 border border-green-200":"bg-gray-100 text-gray-600 border border-gray-200"}`,children:t.published?"Objavljeno":"Nacrt"})}),e.jsx("td",{className:"px-4 py-3 text-right hidden md:table-cell",children:e.jsx("span",{className:"text-xs tabular-nums text-gray-600",children:S(t.viewCount)})}),e.jsx("td",{className:"px-4 py-3 text-right hidden xl:table-cell",title:t.engagementSamples>0?`${t.engagementSamples.toLocaleString("bs-BA")} uzoraka`:"Bez podataka — praćenje teče tek od uvođenja.",children:e.jsx("span",{className:`text-xs tabular-nums ${t.avgReadSec==null?"text-gray-300":t.avgReadSec>=120?"text-green-600":t.avgReadSec>=45?"text-gray-600":"text-amber-600"}`,children:k(t.avgReadSec)})}),e.jsx("td",{className:"px-4 py-3 text-right hidden xl:table-cell",children:e.jsx("span",{className:`text-xs tabular-nums ${t.avgArticleScrollPct==null?"text-gray-300":t.avgArticleScrollPct>=70?"text-green-600":t.avgArticleScrollPct>=40?"text-gray-600":"text-amber-600"}`,children:t.avgArticleScrollPct!=null?`${t.avgArticleScrollPct}%`:"—"})}),e.jsx("td",{className:"px-4 py-3 text-right hidden xl:table-cell",children:e.jsx("span",{className:`text-xs tabular-nums ${t.avgScrollPct==null?"text-gray-300":t.avgScrollPct>=60?"text-green-600":t.avgScrollPct>=30?"text-gray-600":"text-amber-600"}`,children:t.avgScrollPct!=null?`${t.avgScrollPct}%`:"—"})}),e.jsx("td",{className:"px-4 py-3 text-right",children:e.jsxs("div",{className:"flex items-center justify-end gap-2",children:[e.jsx("a",{href:`/post/${t.slug}`,target:"_blank",rel:"noopener",className:"text-xs text-gray-400 hover:text-nap-blue",children:"Pogledaj"}),e.jsx("a",{href:`/admin/posts/${t.slug}`,target:"_blank",rel:"noopener",className:"text-xs text-nap-blue hover:text-nap-blue-dark font-medium",children:"Uredi"}),e.jsx("button",{onClick:()=>m(t.id),className:"text-xs text-gray-400 hover:text-red-600",children:"Obriši"})]})})]},t.id))})]}),s.length===0&&e.jsx("div",{className:"text-center py-12",children:e.jsx("p",{className:"text-gray-400",children:"Nema objava."})})]}),a.totalPages>1&&e.jsxs("div",{className:"mt-4 flex items-center justify-between",children:[e.jsxs("div",{className:"text-xs text-gray-400",children:["Stranica ",a.page," od ",a.totalPages," (",a.total," objava)"]}),e.jsxs("div",{className:"flex items-center gap-1",children:[a.page>1&&e.jsx("a",{href:i({page:a.page-1}),className:"px-3 py-1.5 text-sm bg-gray-100 hover:bg-gray-200 rounded",children:"« Nazad"}),a.page<a.totalPages&&e.jsx("a",{href:i({page:a.page+1}),className:"px-3 py-1.5 text-sm bg-gray-100 hover:bg-gray-200 rounded",children:"Naprijed »"})]})]})]})}const T=Object.freeze(Object.defineProperty({__proto__:null,default:P},Symbol.toStringTag,{value:"Module"})),E={hasServerOnlyHook:{type:"computed",definedAtData:null,valueSerialized:{type:"js-serialized",value:!0}},isClientRuntimeLoaded:{type:"computed",definedAtData:null,valueSerialized:{type:"js-serialized",value:!0}},onBeforeRenderEnv:{type:"computed",definedAtData:null,valueSerialized:{type:"js-serialized",value:null}},dataEnv:{type:"computed",definedAtData:null,valueSerialized:{type:"js-serialized",value:{server:!0}}},guardEnv:{type:"computed",definedAtData:null,valueSerialized:{type:"js-serialized",value:null}},onRenderClient:{type:"standard",definedAtData:{filePathToShowToUser:"vike-react/__internal/integration/onRenderClient",fileExportPathToShowToUser:[]},valueSerialized:{type:"pointer-import",value:y}},Page:{type:"standard",definedAtData:{filePathToShowToUser:"/pages/admin/posts/index/+Page.tsx",fileExportPathToShowToUser:[]},valueSerialized:{type:"plus-file",exportValues:T}},hydrationCanBeAborted:{type:"standard",definedAtData:{filePathToShowToUser:"vike-react/config",fileExportPathToShowToUser:["default","hydrationCanBeAborted"]},valueSerialized:{type:"js-serialized",value:!0}},Layout:{type:"cumulative",definedAtData:[{filePathToShowToUser:"/pages/admin/+Layout.t
1sx",fileExportPathToShowToUser:[]},{filePathToShowToUser:"/pages/+Layout.tsx",fileExportPathToShowToUser:[]}],valueSerialized:[{type:"plus-file",exportValues:N},{type:"plus-file",exportValues:f}]},Loading:{type:"standard",definedAtData:{filePathToShowToUser:"vike-react/__internal/integration/Loading",fileExportPathToShowToUser:[]},valueSerialized:{type:"pointer-import",value:j}}};export{E as configValuesSerialized};

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.