1import{r as s,j as e}from"./vendor-react-CZb8cnW5.js";import{d as C,L as o}from"./vendor-router-tCDV1XcSmc.js";import{g as B,p as m,N as x,q as h,F as u,B as i,h as P}from"./index-B5AJvKiW.js";import{b as n}from"./blogService-Kte-kdQD.js";import"./lazy/vendor-pdf--d4EOpN8.js";import"./vendor-ui-Bc2e1Ld0.js";import"./vendor-utils-CYC2HZ_gIs.js";import"./vendor-query-DLgi7dnP.js";import"./vendor-supabase-Bq_4-p4i.js";const W=()=>{const{category:r}=C(),[l,d]=s.useState([]),[p,b]=s.useState([]),[f,v]=s.useState([]),[j,c]=s.useState(!0),y=r?`${r.charAt(0).toUpperCase()+r.slice(1)} Blog Posts`:"Blog",g=r?`Explore our latest blog posts about ${r}`:"Discover insights, tutorials, and expert advice on marketing, technology, and business growth.";B({title:y,description:g,canonical:r?m(`/blog/category/${r}`):m("/blog")}),s.useEffect(()=>{(async()=>{try{c(!0);const[a,A]=await Promise.all([n.getAllPosts(),n.getAllCategories()]);if(b(a),v(A),r){const E=await n.getPostsByCategory(r);d(E)}else d(a)}catch(a){console.error("Error loading blog data:",a)}finally{c(!1)}})()},[r]);const N=t=>new Date(t).toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"}),w=t=>({marketing:"default",technology:"secondary",startup:"outline"})[t]||"default";return j?e.jsxs("div",{className:"min-h-screen bg-gradient-to-br from-indigo-50 via-white to-purple-50",children:[e.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-indigo-500/5 to-purple-500/5 pointer-events-none"}),e.jsx(x,{}),e.jsx(h,{}),e.jsx("div",{className:"relative",children:e.jsx("div",{className:"max-w-7xl mx-auto px-4 py-20",children:e.jsxs("div",{className:"text-center",children:[e.jsxs("div",{className:"inline-flex items-center px-4 py-2 bg-gradient-to-r from-indigo-100 to-purple-100 rounded-full text-sm font-medium text-indigo-800 mb-8",children:[e.jsx("span",{className:"w-2 h-2 bg-indigo-500 rounded-full mr-2 animate-pulse"}),"Loading Articles"]}),e.jsx("div",{className:"animate-spin rounded-full h-16 w-16 border-4 border-gray-200 border-t-purple-600 mx-auto mb-4"}),e.jsx("p",{className:"text-lg text-gray-600",children:"Fetching the latest insights..."})]})})}),e.jsx(u,{})]}):e.jsxs("div",{className:"min-h-screen bg-gradient-to-br from-indigo-50 via-white to-purple-50 overflow-x-hidden",children:[e.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-indigo-500/5 to-purple-500/5 pointer-events-none"}),e.jsx(x,{}),e.jsx(h,{}),e.jsx("div",{className:"relative overflow-x-hidden",children:e.jsxs("div",{className:"max-w-7xl mx-auto px-4 py-20",children:[e.jsxs("div",{className:"text-center mb-16",children:[e.jsx("div",{className:"flex justify-center mb-6",children:e.jsxs("div",{className:"inline-flex items-center px-4 py-2 bg-gradient-to-r from-indigo-100 to-purple-100 rounded-full text-sm font-medium text-indigo-800",children:[e.jsx("span",{className:"w-2 h-2 bg-indigo-500 rounded-full mr-2"}),r?`${r.charAt(0).toUpperCase()+r.slice(1)} Insights`:"Expert Insights & Tutorials"]})}),e.jsx("h1",{className:"text-5xl md:text-6xl font-bold mb-8 leading-[1.3] pb-4",children:r?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"bg-gradient-to-r from-[#1E1B4B] via-[#2E1065] to-[#4C1D95] bg-clip-text text-transparent",children:r.charAt(0).toUpperCase()+r.slice(1)}),e.jsx("span",{className:"block bg-gradient-to-r from-[#4F46E5] via-[#7C3AED] to-[#9333EA] bg-clip-text text-transparent mt-3 pb-2",children:"Blog Posts"})]}):e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"bg-gradient-to-r from-[#1E1B4B] via-[#2E1065] to-[#4C1D95] bg-clip-text text-transparent",children:"Marketing"}),e.jsx("span",{className:"block bg-gradient-to-r from-[#4F46E5] via-[#7C3AED] to-[#9333EA] bg-clip-text text-transparent mt-3 pb-2",children:"Knowledge Hub"})]})}),e.jsxs("p",{className:"text-xl text-gray-600 mb-8 max-w-3xl mx-auto leading-relaxed",children:[g," Powered by ",e.jsx("a",{href:"/",rel:"home",className:"text-indigo-600 hover:text-indigo-700 transition-colors font-medium",children:"MarketingWand's AI platform"})," for comprehensive marketing strategies."]})]}),e.jsx("div",{className:"mb-12",children:e.jsxs("div",{className:"flex flex-wrap justify-center gap-3",children:[e.jsx(i,{variant:r?"outline":"default",asChild:!0,className:`h-12 px-6 rounded-full font-medium transition-all duration-300 ${r?"bg-white border-gray-200 text-gray-700 hover:bg-gray-50 hover:border-gray-300 hover:shadow-md hover:text-gray-900":"bg-gradient-to-r from-indigo-600 via-purple-600 to-blue-600 hover:from-indigo-700 hover:via-purple-700 hover:to-blue-700 text-white border-0 hover:shadow-xl"}`,children:e.jsx(o,{to:"/blog",children:"All Posts"})}),f.map(t=>e.jsx(i,{variant:r===t?"default":"outline",asChild:!0,className:`h-12 px-6 rounded-full font-medium transition-all duration-300 ${r===t?"bg-gradient-to-r from-indigo-600 via-purple-600 to-blue-600 hover:from-indigo-700 hover:via-purple-700 hover:to-blue-700 text-white border-0 hover:shadow-xl":"bg-white border-gray-200 text-gray-700 hover:bg-gray-50 hover:border-gray-300 hover:shadow-md hover:text-gray-900"}`,children:e.jsx(o,{to:`/blog/category/${t}`,children:t.charAt(0).toUpperCase()+t.slice(1)})},t))]})}),l.length===0?e.jsx("div",{className:"text-center py-20",children:e.jsxs("div",{className:"bg-white rounded-2xl shadow-xl border border-gray-100 p-12 max-w-2xl mx-auto",children:[e.jsx("div",{className:"w-16 h-16 bg-gradient-to-br from-gray-100 to-gray-200 rounded-full flex items-center justify-center mx-auto mb-6",children:e.jsx("span",{className:"text-2xl text-gray-400",children:"ð"})}),e.jsx("h3",{className:"text-2xl font-bold text-gray-900 mb-4",children:"No articles found"}),e.jsx("p",{className:"text-lg text-gray-600 mb-8 leading-relaxed",children:r?`We haven't published any articles in the "${r}" category yet.`:"We're working on some amazing content for you."}),r&&e.jsx(i,{asChild:!0,className:"bg-gradient-to-r from-indigo-600 via-purple-600 to-blue-600 hover:from-indigo-700 hover:via-purple-700 hover:to-blue-700 text-white border-0 rounded-full px-8 py-3 transform hover:scale-105 transition-all duration-300",children:e.jsx(o,{to:"/blog",children:"View All Articles"})})]})}):e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-8",children:l.map((t,a)=>e.jsx(o,{to:`/blog/${t.slug}`,className:"group block",style:{animationDelay:`${a*.1}s`},children:e.jsxs("article",{className:"bg-white rounded-2xl shadow-lg border border-gray-100 hover:shadow-xl transition-shadow duration-300 overflow-hidden h-full flex flex-col",children:[e.jsx("div",{className:"aspect-video bg-gradient-to-br from-gray-100 to-gray-200 overflow-hidden",children:e.jsx("img",{src:t.image,alt:t.imageAlt,className:"w-full h-full object-cover"})}),e.jsxs("div",{className:"p-6 flex flex-col flex-grow",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsx(P,{variant:w(t.category),className:`px-3 py-1 rounded-full text-xs font-medium ${t.category==="marketing"?"bg-gradient-to-r from-blue-100 to-blue-200 text-blue-800 border-blue-200":t.category==="technology"?"bg-gradient-to-r from-purple-100 to-purple-200 text-purple-800 border-purple-200":"bg-gradient-to-r from-emerald-100 to-emerald-200 text-emerald-800 border-emerald-200"}`,children:t.category}),e.jsx("span",{className:"text-sm text-gray-500 font-medium",children:N(t.date)})]}),e.jsx("h3",{className:"text-xl font-bold text-gray-900 mb-3 line-clamp-2 group-hover:text-purple-700 transition-colors duration-300",children:t.title}),e.jsx("p",{className:"text-gray-600 mb-4 line-clamp-3 leading-relaxed",children:t.description}),e.jsx("div",{className:"flex-grow",children:t.tldr?e.jsxs("div",{className:"bg-gradient-to-r from-indigo-50 to-purple-50 p-4 rounded-xl mb-4 border border-indigo-100",children:[e.jsxs("p",{className:"text-sm font-semibold text-indigo-800 mb
1-2 flex items-center",children:[e.jsx("span",{className:"w-2 h-2 bg-indigo-500 rounded-full mr-2"}),"Quick Takeaway"]}),e.jsx("p",{className:"text-sm text-indigo-700 leading-relaxed",children:t.tldr})]}):e.jsx("div",{className:"mb-4 h-[88px]"})}),e.jsxs("div",{className:"flex items-center justify-between mt-auto pt-4",children:[e.jsxs("span",{className:"text-sm text-gray-500",children:[Math.ceil((t.excerpt||t.description).split(" ").length*5/200)," min read"]}),e.jsx("span",{className:"text-sm font-medium text-purple-600 group-hover:text-purple-700 transition-colors duration-300",children:"Read Article â"})]})]})]})},t.slug))}),l.length>0&&e.jsx("div",{className:"mt-12 text-center text-gray-600",children:e.jsxs("p",{children:["Showing ",l.length," of ",p.length," posts",r&&` in "${r}"`]})})]})}),e.jsx(u,{})]})};export{W 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.