1import{c as p,j as e,X as y,l as b,L as h,B as g,r as d,m as N,k as v}from"./index-CNPsGjEa.js";import{S as w}from"./SEO-BK0024z7.js";import{b as C,c as k,B as P}from"./blogData-CfSNQUI-.js";import{N as L,F as S}from"./Footer-C2mwZlj3.js";import{B}from"./BlurBackground-KGxn8exw.js";import{S as A}from"./Animations-xGM3DZYN.js";import{I as T}from"./input-BVM4_asw.js";import{S as E}from"./search-tmSGKc_r.js";import{C as u}from"./clock-CTynZiS8.js";import{s as M}from"./client-BomsTZso.js";import{C as $}from"./calendar-CceEaajA.js";import"./index-D9eVhfiJ.js";/** 2 * @license lucide-react v0.462.0 - ISC 3 * 4 * This source code is licensed under the ISC license. 5 * See the LICENSE file in the root directory of this source tree. 6 */const R=p("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);/** 7 * @license lucide-react v0.462.0 - ISC 8 * 9 * This source code is licensed under the ISC license. 10 * See the LICENSE file in the root directory of this source tree. 11 */const D=p("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=({searchTerm:s,setSearchTerm:a})=>{const t=()=>{a("")};return e.jsxs("div",{className:"max-w-2xl mx-auto relative",children:[e.jsx("label",{htmlFor:"blog-search",className:"sr-only",children:"Search articles"}),e.jsx(T,{id:"blog-search",type:"search",placeholder:"Search articles...",value:s,onChange:m=>a(m.target.value),className:"pl-10 sm:pl-12 py-3 sm:py-4 md:py-6 text-sm sm:text-base md:text-lg","aria-label":"Search blog articles"}),e.jsx(E,{className:"absolute left-3 sm:left-4 top-1/2 transform -translate-y-1/2 text-muted-foreground h-4 w-4 sm:h-5 sm:w-5","aria-hidden":"true"}),s&&e.jsx("button",{onClick:t,className:"absolute right-3 sm:right-4 top-1/2 transform -translate-y-1/2 text-muted-foreground hover:text-foreground p-1 transition-colors","aria-label":"Clear search",type:"button",children:e.jsx(y,{className:"h-4 w-4 sm:h-5 sm:w-5"})})]})},H=({searchTerm:s,setSearchTerm:a})=>{const{t,localePath:m}=b();return e.jsx("section",{className:"container mx-auto px-4 sm:px-6 lg:px-8 mb-8 sm:mb-12 md:mb-16","aria-label":"Blog introduction",children:e.jsxs(A,{children:[e.jsxs("h1",{className:"text-2xl sm:text-3xl md:text-4xl lg:text-5xl xl:text-6xl font-bold mb-4 sm:mb-6 text-center",children:[t("blog.title")," ",e.jsx("span",{className:"text-primary",children:t("blog.titleHighlight")})]}),e.jsx("p",{className:"text-base sm:text-lg md:text-xl text-center max-w-3xl mx-auto mb-6 sm:mb-8 md:mb-12 text-muted-foreground",children:t("blog.subtitle")}),e.jsx(F,{searchTerm:s,setSearchTerm:a}),e.jsx("nav",{className:"text-center mt-6 sm:mt-8","aria-label":"Related sections",children:e.jsx(h,{to:m("/webinars"),className:"inline-flex items-center px-4 sm:px-6 py-2.5 sm:py-3 bg-primary text-primary-foreground rounded-lg hover:bg-primary/90 transition-colors font-medium text-sm sm:text-base",children:t("blog.checkWebinars")})})]})})},f=({post:s,featured:a=!1})=>a?e.jsx("article",{className:"bg-card rounded-xl overflow-hidden shadow-lg",children:e.jsxs("div",{className:"grid md:grid-cols-2 gap-0",children:[e.jsx("div",{className:"h-48 sm:h-56 md:h-auto overflow-hidden",children:e.jsx("img",{src:s.image,alt:s.title,loading:"eager",decoding:"async",className:"w-full h-full object-cover",width:600,height:400})}),e.jsxs("div",{className:"p-5 sm:p-6 md:p-8 lg:p-12",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2 mb-3 md:mb-4",children:[e.jsx("span",{className:"bg-primary text-primary-foreground text-xs sm:text-sm px-2.5 sm:px-3 py-0.5 sm:py-1 rounded-full",children:s.category}),e.jsxs("span",{className:"text-muted-foreground text-xs sm:text-sm flex items-center",children:[e.jsx(u,{className:"h-3 w-3 sm:h-4 sm:w-4 mr-1","aria-hidden":"true"}),e.jsx("span",{children:s.readTime})]})]}),e.jsx("h2",{className:"text-lg sm:text-xl md:text-2xl font-bold mb-2 sm:mb-3 md:mb-4 line-clamp-2",children:s.title}),e.jsx("p",{className:"text-muted-foreground text-sm sm:text-base mb-4 sm:mb-6 line-clamp-2 md:line-clamp-3",children:s.excerpt}),e.jsx("div",{className:"flex items-center mb-4 sm:mb-6",children:e.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground",children:s.date})}),e.jsx(h,{to:`/blog/${s.id}`,className:"inline-flex items-center justify-center bg-primary hover:bg-primary/90 text-primary-foreground px-4 py-2 text-sm sm:text-base rounded transition-colors","aria-label":`Read article: ${s.title}`,children:"Read Article"})]})]})}):e.jsxs("article",{className:"bg-card rounded-lg overflow-hidden shadow-md hover:shadow-lg transition-shadow",children:[e.jsx("div",{className:"h-36 sm:h-40 md:h-48 overflow-hidden",children:e.jsx("img",{src:s.image,alt:s.title,loading:"lazy",decoding:"async",className:"w-full h-full object-cover",width:400,height:200})}),e.jsxs("div",{className:"p-4 sm:p-5 md:p-6",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2 sm:mb-3",children:[e.jsx("span",{className:"bg-muted text-xs px-2 py-0.5 rounded text-foreground",children:s.category}),e.jsxs("span",{className:"text-muted-foreground text-xs flex items-center",children:[e.jsx(u,{className:"h-3 w-3 mr-1","aria-hidden":"true"}),e.jsx("span",{children:s.readTime})]})]}),e.jsx("h3",{className:"text-base sm:text-lg md:text-xl font-bold mb-1.5 sm:mb-2 line-clamp-2",children:s.title}),e.jsx("p",{className:"text-muted-foreground text-xs sm:text-sm mb-3 sm:mb-4 line-clamp-2",children:s.excerpt}),e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("span",{className:"text-xs sm:text-sm text-muted-foreground truncate",children:s.date}),e.jsx(h,{to:`/blog/${s.id}`,className:"text-primary hover:text-primary/80 text-xs sm:text-sm font-medium whitespace-nowrap transition-colors","aria-label":`Read more about ${s.title}`,children:"Read more"})]})]})]}),I=({post:s})=>e.jsx("section",{className:"py-6 sm:py-8 md:py-12","aria-labelledby":"featured-heading",children:e.jsxs("div",{className:"container mx-auto px-4 sm:px-6 lg:px-8",children:[e.jsx("h2",{id:"featured-heading",className:"text-xl sm:text-2xl md:text-3xl font-bold mb-4 sm:mb-6 md:mb-8",children:"Featured Article"}),e.jsx(f,{post:s,featured:!0})]})}),_=({posts:s})=>e.jsxs("section",{className:"container mx-auto px-4 sm:px-6 lg:px-8 mb-8 sm:mb-12 md:mb-16","aria-labelledby":"latest-heading",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row justify-between items-start sm:items-center gap-3 sm:gap-4 mb-6 sm:mb-8",children:[e.jsx("h2",{id:"latest-heading",className:"text-xl sm:text-2xl font-bold",children:"Latest Articles"}),e.jsx(g,{variant:"outline",asChild:!0,size:"sm",className:"sm:hidden",children:e.jsx(h,{to:"/blog",children:"View All"})}),e.jsx(g,{variant:"outline",asChild:!0,className:"hidden sm:inline-flex",children:e.jsx(h,{to:"/blog",children:"View All"})})]}),e.jsx("div",{className:"grid gap-4 sm:gap-6 md:gap-8 grid-cols-1 sm:grid-cols-2 lg:grid-cols-3",children:s.map(a=>e.jsx(f,{post:a},a.id))})]}),z=s=>!s||/^audience\s*:/i.test(s.trim())?"":s,j=()=>{const[s,a]=d.useState([]),[t,m]=d.useState(!0);d.useEffect(()=>{(async()=>{try{const{data:r,error:c}=await M.from("blog_posts").select("*").eq("is_published",!0).order("published_at",{ascending:!1});if(c){console.error("Error fetching blog posts:",c);return}if(r){const x=r.map(l=>({id:l.id+1e3,title:l.title,excerpt:l.excerpt,author:z(l.author),date:l.published_at?new Date(l.published_at).toLocaleDateString("en-GB",{year:"numeric",month:"long",day:"numeric"}):"",readTime:l.read_time,category:l.category,image:l.image}));a(x)}}catch(r){console.error("Error fetching blog posts:",r)}finally{m(!1)}})()},[]);const n=d.useMemo(()=>[...s,...C],[s]),i=d.useMemo(()=>{const o=new Map;
11return n.forEach(r=>{r.category&&o.set(r.category,(o.get(r.category)||0)+1)}),k.forEach(r=>{o.has(r)||o.set(r,0)}),Array.from(o.entries()).sort((r,c)=>c[1]-r[1]||r[0].localeCompare(c[0])).map(([r])=>r)},[n]);return{posts:n,categories:i,loading:t}},q=({name:s})=>{const a=N(),{posts:t}=j(),m=t.filter(i=>i.category===s).length,n=i=>{i.preventDefault(),a("/blog",{state:{searchCategory:s}})};return e.jsxs("a",{href:"#",onClick:n,className:"bg-card p-2.5 sm:p-3 md:p-4 rounded border border-border flex justify-between items-center hover:border-primary transition-colors focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-2 text-sm sm:text-base","aria-label":`View ${m} articles in ${s} category`,children:[e.jsx("span",{className:"truncate",children:s}),e.jsx("span",{className:"text-muted-foreground text-xs sm:text-sm ml-2 flex-shrink-0",children:m})]})},V=({post:s})=>e.jsx(h,{to:`/blog/${s.id}`,className:"block hover:shadow-md transition-shadow duration-200 focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-2 rounded-lg","aria-label":`Read article: ${s.title}`,children:e.jsxs("article",{className:"flex bg-card p-3 sm:p-4 rounded-lg border border-border",children:[e.jsx("div",{className:"w-16 h-16 sm:w-20 sm:h-20 md:w-24 md:h-24 bg-cover bg-center rounded flex-shrink-0",style:{backgroundImage:`url(${s.image})`},role:"img","aria-label":s.title}),e.jsxs("div",{className:"ml-3 sm:ml-4 min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2 sm:gap-3 mb-1 text-xs text-muted-foreground",children:[e.jsxs("span",{className:"flex items-center",children:[e.jsx($,{className:"h-3 w-3 mr-1","aria-hidden":"true"}),e.jsx("time",{dateTime:s.date,children:s.date})]}),e.jsxs("span",{className:"flex items-center",children:[e.jsx(u,{className:"h-3 w-3 mr-1","aria-hidden":"true"}),s.readTime]})]}),e.jsx("h3",{className:"font-bold text-sm sm:text-base mb-1 line-clamp-1",children:s.title}),e.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground line-clamp-1 sm:line-clamp-2",children:s.excerpt})]})]})}),O=({categories:s,popularPosts:a})=>e.jsx("section",{className:"bg-muted/50 py-8 sm:py-12 md:py-16","aria-label":"Categories and popular posts",children:e.jsx("div",{className:"container mx-auto px-4 sm:px-6 lg:px-8",children:e.jsxs("div",{className:"grid gap-8 sm:gap-10 md:gap-12 md:grid-cols-2",children:[e.jsxs("div",{children:[e.jsxs("h2",{className:"text-lg sm:text-xl md:text-2xl font-bold mb-4 sm:mb-6 flex items-center",children:[e.jsx(D,{className:"mr-2 h-4 w-4 sm:h-5 sm:w-5 text-primary","aria-hidden":"true"}),"Categories"]}),e.jsx("nav",{"aria-label":"Blog categories",children:e.jsx("ul",{className:"grid grid-cols-2 gap-2 sm:gap-3 md:gap-4",children:s.map(t=>e.jsx("li",{children:e.jsx(q,{name:t})},t))})})]}),e.jsxs("div",{children:[e.jsxs("h2",{className:"text-lg sm:text-xl md:text-2xl font-bold mb-4 sm:mb-6 flex items-center",children:[e.jsx(R,{className:"mr-2 h-4 w-4 sm:h-5 sm:w-5 text-primary","aria-hidden":"true"}),"Popular Posts"]}),e.jsx("div",{className:"space-y-3 sm:space-y-4 md:space-y-6",children:a.map(t=>e.jsx(V,{post:t},t.id))})]})]})})}),ae=()=>{const a=v().state,[t,m]=d.useState(""),{t:n}=b(),{posts:i,categories:o}=j();d.useEffect(()=>{a!=null&&a.searchCategory&&(m(a.searchCategory),window.history.replaceState({},document.title))},[a]);const r=d.useMemo(()=>{if(!t.trim())return i;const x=t.toLowerCase();return i.filter(l=>l.title.toLowerCase().includes(x)||l.excerpt.toLowerCase().includes(x)||l.category.toLowerCase().includes(x)||l.author.toLowerCase().includes(x))},[t,i]),c=r.length>0;return e.jsxs(e.Fragment,{children:[e.jsx(w,{title:"Developer Blog - Tutorials, Insights & Career Advice",description:"Explore in-depth tutorials, industry insights, and career advice for developers. Learn about web development, blockchain, DevOps, and more.",canonicalUrl:"/blog",ogType:"website"}),e.jsx(P,{isList:!0,posts:i}),e.jsxs("div",{className:"min-h-screen w-full overflow-hidden",children:[e.jsx(B,{}),e.jsx(L,{}),e.jsxs("main",{className:"pt-24 sm:pt-28 md:pt-32 pb-12 md:pb-16",children:[e.jsx(H,{searchTerm:t,setSearchTerm:m}),!c&&t&&e.jsxs("section",{className:"container mx-auto px-4 text-center mt-8 md:mt-12","aria-label":"Search results",children:[e.jsx("h2",{className:"text-xl md:text-2xl font-semibold mb-3 md:mb-4",children:n("blog.noResults")}),e.jsx("p",{className:"text-muted-foreground text-sm md:text-base",children:n("blog.noResultsDesc").replace("{term}",t)})]}),c&&(!t||r.includes(i[0]))&&e.jsx(I,{post:i[0]}),c&&e.jsx(_,{posts:t?r:r.slice(1,4)}),e.jsx(O,{categories:o,popularPosts:i.slice(3,5)})]}),e.jsx(S,{})]})]})};export{ae 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.