1import{u as P,r as o,f as C,s as A,j as s,d as p,H as k,B,a as R}from"./index-DrAEDOWO.js";import{u as E,a as L,B as M}from"./BlogCard-CV-GmvKV.js";import"./purify.es-A66Cw1IH.js";const S=()=>{const[t,f]=P(),l=t.get("category")||"All",{data:a}=E(),b=o.useMemo(()=>{if(l==="All"||!a)return;const e=a.find(r=>r.name===l);return e==null?void 0:e.id},[l,a]),{data:d,isLoading:c,fetchNextPage:j,hasNextPage:y,isFetchingNextPage:i}=L(10,b),n=o.useMemo(()=>a?["All",...a.map(e=>e.name)]:["All"],[a]),m=o.useMemo(()=>d?d.pages.flatMap(e=>e).map(e=>{var g,x,u,h;const r=((g=a==null?void 0:a.find(w=>e.categories.includes(w.id)))==null?void 0:g.name)||"Uncategorized",v=((h=(u=(x=e._embedded)==null?void 0:x["wp:featuredmedia"])==null?void 0:u[0])==null?void 0:h.source_url)||"https://placehold.co/600x400?text=Rankpilot";return{title:e.title.rendered,excerpt:A(e.excerpt.rendered),image:v,slug:e.slug,date:C(e.date),category:r}}):[],[d,a]),N=e=>{e==="All"?t.delete("category"):t.set("category",e),f(t)};return s.jsxs("main",{className:p("relative space-y-10 pb-16 md:pb-20",R),children:[s.jsx(k,{children:s.jsx("title",{children:"Blogs | Rankpilot"})}),s.jsx("section",{className:"mx-auto max-w-xl px-4 text-center",children:s.jsxs("div",{className:"space-y-5 sm:space-y-7",children:[s.jsx("h1",{className:"page-head",children:"Rankpilot Blogs"}),s.jsx("p",{className:"page-desc",children:"Fresh SEO workflows and Rankpilot updates. Choose a category or browse the latest articles below."})]})}),s.jsx("section",{className:"container flex justify-center",children:s.jsx("div",{className:"flex flex-wrap items-center gap-3",children:n==null?void 0:n.map(e=>s.jsx("button",{onClick:()=>N(e),className:p("rounded-full border px-4 py-2 text-sm font-medium transition",l===e?"border-blue bg-blue text-white":"border-gray-200 text-gray-600 hover:border-blue hover:text-blue"),children:e},e))})}),s.jsxs("section",{className:"container grid gap-8 md:grid-cols-2 lg:grid-cols-3",children:[c?Array.from({length:6}).map((e,r)=>s.jsxs("div",{className:"h-96 animate-pulse space-y-4 overflow-hidden rounded-3xl border border-gray-200 bg-gray-50",children:[s.jsx("div",{className:"h-48 bg-gray-200"}),s.jsxs("div",{className:"space-y-4 p-6",children:[s.jsx("div",{className:"h-4 w-1/4 rounded bg-gray-200"}),s.jsx("div",{className:"h-6 w-3/4 rounded bg-gray-200"}),s.jsx("div",{className:"mb-2! h-4 w-full rounded bg-gray-200"}),s.jsx("div",{className:"h-4 w-5/6 rounded bg-gray-200"})]})]},r)):m.length>0?m.map(e=>s.jsx(M,{...e},e.slug)):s.jsx("div",{className:"col-span-full py-20 text-center text-gray-600",children:"No posts found"}),!c&&y&&s.jsx("div",{className:"col-span-full mt-16 flex justify-center",children:s.jsx(B,{onClick:()=>j(),disabled:i,children:i?"Loading...":"Load More"})})]})]})};export{S as Blog};
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.