import{j as e}from"./vendor-radix-DNxwLykc.js";import{r as p}from"./vendor-react-BsBmf7g_.js";import{L as C}from"./vendor-router-CYowL1Ry.js";import{c as j,u as w,S,N as P,B as m,L as B,M as L,a as k,C as E,A as _,b as T,F as I}from"./index-E4maWKVN.js";import{u as M}from"./useBlogPosts-CY-W8YUX.js";import{u as R}from"./useBlogCategories-BCg1DU9Q.js";import{B as z}from"./badge-QCQuxjG4.js";import{U as A}from"./user-DJoWLxvh.js";import"./vendor-supabase-DZNfQC5M.js";import"./vendor-charts-CaDQ2cwY.js";import"./vendor-data-D4F9-7cQ.js";/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const D=j("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const V=j("Tag",[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]]),F=["Toronto","Vancouver","Montreal","Montréal","Brampton","Mississauga","Scarborough","North York","Etobicoke","East York","York","Vaughan","Surrey","Burnaby","Coquitlam","Richmond","North Vancouver","Laval","Longueuil","Brossard","Terrebonne"],f=["Commercial Cleaning","Office Cleaning","Industrial Cleaning","Event Cleaning","Specialized Cleaning","Janitorial","Post-Construction","Carpet Cleaning","Disinfection","Warehouse Cleaning","Floor Cleaning","Deep Cleaning"],b=["Nettoyage commercial","Nettoyage de bureaux","Nettoyage industriel","Nettoyage d'événements","Nettoyage spécialisé","Conciergerie","Après construction","Nettoyage de tapis","Désinfection","Nettoyage d'entrepôt","Nettoyage de plancher","Grand ménage"];function O(r){for(const s of F)if(r.toLowerCase().includes(s.toLowerCase()))return s;return null}function Y(r,s){const n=s==="fr"?[...b,...f]:[...f,...b];for(const l of n)if(r.toLowerCase().includes(l.toLowerCase()))return l;return null}function ee(){const[r,s]=p.useState(1),[n,l]=p.useState(null),N=9,{language:d,t:a}=w(),{data:i,isLoading:y}=M({page:r,limit:N,categoryId:n,sortBy:"recent",language:d}),{data:g}=R(),o=(i==null?void 0:i.posts)||[],c=(i==null?void 0:i.totalPages)||0,v={"@context":"https://schema.org","@type":"Blog",name:a("blog.pageTitle"),description:a("blog.pageDescription"),url:"https://ssimple.ca/blog",publisher:{"@type":"Organization",name:"Simple Service",url:"https://ssimple.ca"},...o.length>0&&{blogPost:o.map(t=>({"@type":"BlogPosting",headline:t.title,url:`https://ssimple.ca/blog/${t.slug}`,...t.featured_image_url&&{image:t.featured_image_url},...t.published_at&&{datePublished:t.published_at},...t.author&&{author:{"@type":"Person",name:t.author.name}},...t.excerpt&&{description:t.excerpt}}))}};return e.jsxs("div",{className:"min-h-screen bg-background",children:[e.jsx(S,{title:a("blog.pageTitle"),description:a("blog.pageDescription"),path:"/blog",children:e.jsx("script",{type:"application/ld+json",children:JSON.stringify(v)})}),e.jsx(P,{}),e.jsxs("main",{className:"container-custom py-12 pt-32 md:pt-36",children:[e.jsxs("div",{className:"text-center mb-12",children:[e.jsx("h1",{className:"text-4xl font-light mb-4",children:a("blog.title")}),e.jsx("p",{className:"text-muted-foreground max-w-2xl mx-auto",children:a("blog.subtitle")})]}),g&&g.length>0&&e.jsxs("nav",{"aria-label":"Blog categories",className:"flex flex-wrap gap-2 justify-center mb-10",children:[e.jsx(m,{variant:n===null?"default":"outline",size:"sm",onClick:()=>{l(null),s(1)},children:a("blog.all")}),g.map(t=>e.jsx(m,{variant:n===t.id?"default":"outline",size:"sm",onClick:()=>{l(t.id),s(1)},children:t.name},t.id))]}),y?e.jsx("div",{className:"flex justify-center py-20",children:e.jsx(B,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):o.length===0?e.jsx("div",{className:"text-center py-20 text-muted-foreground",children:e.jsx("p",{children:a("blog.noPosts")})}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-8",children:o.map(t=>{const x=O(t.title),u=Y(t.title,t.language||d);return e.jsx("article",{itemScope:!0,itemType:"https://schema.org/BlogPosting",children:e.jsx(C,{to:`/blog/${t.slug}`,className:"group flex flex-col h-full bg-card rounded-lg border overflow-hidden hover:shadow-lg hover:border-foreground/20 transition-all duration-300",children:e.jsxs("div",{className:"flex flex-col flex-1 p-5",children:[e.jsxs("div",{className:"flex flex-wrap gap-1.5 mb-3 min-h-[24px]",children:[x&&e.jsxs("span",{className:"inline-flex items-center gap-1 bg-muted text-foreground text-[11px] font-medium px-2 py-0.5 rounded-full",children:[e.jsx(L,{className:"h-3 w-3 text-[hsl(var(--accent-blue))]"}),x]}),u&&e.jsxs("span",{className:"inline-flex items-center gap-1 bg-muted text-foreground text-[11px] font-medium px-2 py-0.5 rounded-full",children:[e.jsx(k,{className:"h-3 w-3 text-[hsl(var(--accent-blue))]"}),u]})]}),t.category&&e.jsx(z,{variant:"secondary",className:"mb-2 w-fit text-[11px]",children:t.category.name}),e.jsx("h2",{className:"text-base font-semibold mb-2 group-hover:text-[hsl(var(--accent-blue))] transition-colors line-clamp-2",itemProp:"headline",children:t.title}),e.jsx("p",{className:"text-sm text-muted-foreground mb-3 line-clamp-2 flex-1",itemProp:"description",children:t.excerpt||""}),e.jsxs("div",{className:"flex flex-wrap gap-1 mb-3 min-h-[20px]",children:[t.tags&&t.tags.length>0&&t.tags.slice(0,3).map(h=>e.jsxs("span",{className:"inline-flex items-center gap-0.5 text-[10px] text-muted-foreground bg-muted px-1.5 py-0.5 rounded",children:[e.jsx(V,{className:"h-2.5 w-2.5"}),h.name]},h.id)),t.tags&&t.tags.length>3&&e.jsxs("span",{className:"text-[10px] text-muted-foreground",children:["+",t.tags.length-3]})]}),e.jsxs("div",{className:"flex items-center justify-between text-xs text-muted-foreground pt-3 border-t border-border mt-auto",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[t.author&&e.jsxs("span",{className:"flex items-center gap-1",itemProp:"author",itemScope:!0,itemType:"https://schema.org/Person",children:[e.jsx(A,{className:"h-3 w-3"}),e.jsx("span",{itemProp:"name",className:"truncate max-w-[80px]",children:t.author.name})]}),t.published_at&&e.jsxs("time",{className:"flex items-center gap-1",dateTime:t.published_at,itemProp:"datePublished",children:[e.jsx(E,{className:"h-3 w-3"}),new Date(t.published_at).toLocaleDateString(d==="fr"?"fr-CA":"en-CA",{month:"short",day:"numeric"})]})]}),e.jsx(_,{className:"h-4 w-4 group-hover:translate-x-1 transition-transform"})]})]})})},t.id)})}),c>1&&e.jsxs("nav",{"aria-label":"Blog pagination",className:"flex items-center justify-center gap-2 mt-12",children:[e.jsx(m,{variant:"outline",size:"sm",onClick:()=>s(t=>Math.max(1,t-1)),disabled:r===1,children:e.jsx(D,{className:"h-4 w-4"})}),e.jsxs("span",{className:"text-sm text-muted-foreground px-3",children:[a("blog.page")," ",r," ",a("blog.of")," ",c]}),e.jsx(m,{variant:"outline",size:"sm",onClick:()=>s(t=>Math.min(c,t+1)),disabled:r===c,children:e.jsx(T,{className:"h-4 w-4"})})]})]}),e.jsx("noscript",{children:e.jsxs("div",{style:{padding:"2rem"},children:[e.jsx("h2",{children:"Recent Articles"}),e.jsxs("p",{children:["Visit ",e.jsx("a",{href:"https://ssimple.ca/blog",children:"ssimple.ca/blog"})," to browse all articles about commercial cleaning, janitorial services, and facility maintenance across Canada."]}),e.jsx("p",{children:e.jsx("a",{href:"https://ssimple.ca/sitemap.xml",children:"View Sitemap"})})]})})]}),e.jsx(I,{})]})}export{ee as default};