{"version":3,"file":"Blogcomponents.B7LdYN1V.mjs","names":["useState"],"sources":["https:/framerusercontent.com/modules/CEeymqQ3DhJI49KmSVxn/0PaYDwq3Z6nbsgZLb7sE/Blogcomponents.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useEffect,useState}from\"react\";// ── CONFIGURATION ──────────────────────────────────\nconst SUPABASE_URL=\"https://rfjkpzhztbhdzugxqtcw.supabase.co\";const SUPABASE_ANON_KEY=\"sb_publishable_JWHlj6xoXLMse2ICYeULwQ_EtujyaVm\";// ────────────────────────────────────────────────────\n// Colors (white on blue background)\nconst C_HEADING=\"#ffffff\";const C_BODY=\"#ffffff\";const C_SUBTLE=\"rgba(255,255,255,0.85)\";const C_META=\"rgba(255,255,255,0.65)\";function formatDate(iso){if(!iso)return\"\";return new Date(iso).toLocaleDateString(\"en-GB\",{year:\"numeric\",month:\"long\",day:\"numeric\"});}// ── BLOG LIST COMPONENT ────────────────────────────\nexport function BlogList(){const[posts,setPosts]=useState([]);const[loading,setLoading]=useState(true);const[error,setError]=useState(null);useEffect(()=>{fetch(`${SUPABASE_URL}/rest/v1/blog_posts?select=title,slug,description,tagline,thumbnail_1_url,thumbnail_1_alt,published_at,tags&status=eq.published&order=published_at.desc`,{headers:{apikey:SUPABASE_ANON_KEY,Authorization:`Bearer ${SUPABASE_ANON_KEY}`}}).then(res=>{if(!res.ok)throw new Error(`HTTP ${res.status}`);return res.json();}).then(data=>{setPosts(data);setLoading(false);}).catch(err=>{setError(err.message);setLoading(false);});},[]);if(loading){return /*#__PURE__*/_jsx(\"div\",{style:{width:\"100%\",padding:\"2rem\",textAlign:\"center\",color:C_META},children:\"Loading posts...\"});}if(error){return /*#__PURE__*/_jsx(\"div\",{style:{width:\"100%\",padding:\"2rem\",textAlign:\"center\",color:\"#ffb3b3\"},children:\"Could not load posts.\"});}if(posts.length===0){return /*#__PURE__*/_jsx(\"div\",{style:{width:\"100%\",padding:\"2rem\",textAlign:\"center\",color:C_META},children:\"No posts yet.\"});}return /*#__PURE__*/_jsx(\"div\",{style:{width:\"100%\",height:\"100%\",overflowY:\"auto\"},children:/*#__PURE__*/_jsx(\"div\",{style:{width:\"100%\",maxWidth:\"800px\",margin:\"0 auto\",display:\"grid\",gap:\"2rem\",padding:\"2rem 0\"},children:posts.map(post=>/*#__PURE__*/_jsxs(\"a\",{href:`/blog/post?slug=${post.slug}`,style:{display:\"grid\",gridTemplateColumns:post.thumbnail_1_url?\"200px 1fr\":\"1fr\",gap:\"1.5rem\",textDecoration:\"none\",color:C_HEADING,padding:\"1rem 0\",borderBottom:\"1px solid rgba(255,255,255,0.2)\"},children:[post.thumbnail_1_url&&/*#__PURE__*/_jsx(\"img\",{src:post.thumbnail_1_url,alt:post.thumbnail_1_alt||post.title,style:{width:\"100%\",height:\"140px\",objectFit:\"cover\",borderRadius:\"8px\"}}),/*#__PURE__*/_jsxs(\"div\",{children:[/*#__PURE__*/_jsx(\"h2\",{style:{margin:\"0 0 0.5rem\",fontSize:\"1.4rem\",lineHeight:1.3,color:C_HEADING},children:post.title}),post.tagline&&/*#__PURE__*/_jsx(\"p\",{style:{margin:\"0 0 0.5rem\",fontSize:\"0.95rem\",color:C_SUBTLE},children:post.tagline}),/*#__PURE__*/_jsx(\"p\",{style:{margin:\"0 0 0.5rem\",fontSize:\"0.9rem\",color:C_SUBTLE,lineHeight:1.5},children:post.description}),/*#__PURE__*/_jsxs(\"div\",{style:{display:\"flex\",gap:\"1rem\",fontSize:\"0.8rem\",color:C_META},children:[/*#__PURE__*/_jsx(\"span\",{children:formatDate(post.published_at)}),post.tags&&post.tags.length>0&&/*#__PURE__*/_jsx(\"span\",{children:post.tags.slice(0,3).join(\" \\xb7 \")})]})]})]},post.slug))})});}// ── BLOG POST COMPONENT ────────────────────────────\nexport function BlogPost(){const[post,setPost]=useState(null);const[loading,setLoading]=useState(true);const[notFound,setNotFound]=useState(false);useEffect(()=>{const params=new URLSearchParams(window.location.search);const slug=params.get(\"slug\");if(!slug){setNotFound(true);setLoading(false);return;}fetch(`${SUPABASE_URL}/rest/v1/blog_posts?select=*&slug=eq.${encodeURIComponent(slug)}&status=eq.published&limit=1`,{headers:{apikey:SUPABASE_ANON_KEY,Authorization:`Bearer ${SUPABASE_ANON_KEY}`}}).then(res=>{if(!res.ok)throw new Error(`HTTP ${res.status}`);return res.json();}).then(data=>{if(data.length===0){setNotFound(true);}else{const p=data[0];setPost(p);// Dynamic SEO\ndocument.title=p.seo_title||p.title;const setMeta=(name,content)=>{let el=document.querySelector(`meta[name=\"${name}\"]`);if(!el){el=document.createElement(\"meta\");el.name=name;document.head.appendChild(el);}el.content=content;};if(p.meta_description)setMeta(\"description\",p.meta_description);// Open Graph\nconst setProp=(property,content)=>{let el=document.querySelector(`meta[property=\"${property}\"]`);if(!el){el=document.createElement(\"meta\");el.setAttribute(\"property\",property);document.head.appendChild(el);}el.content=content;};if(p.og_title)setProp(\"og:title\",p.og_title);if(p.og_description)setProp(\"og:description\",p.og_description);if(p.og_image_url||p.thumbnail_1_url)setProp(\"og:image\",p.og_image_url||p.thumbnail_1_url||\"\");// JSON-LD injection\nif(p.json_ld){const existing=document.querySelector('script[type=\"application/ld+json\"].blog-post-ld');if(existing)existing.remove();const script=document.createElement(\"script\");script.type=\"application/ld+json\";script.className=\"blog-post-ld\";script.textContent=p.json_ld;document.head.appendChild(script);}}setLoading(false);}).catch(()=>{setNotFound(true);setLoading(false);});},[]);if(loading){return /*#__PURE__*/_jsx(\"div\",{style:{width:\"100%\",padding:\"2rem\",textAlign:\"center\",color:C_META},children:\"Loading...\"});}if(notFound||!post){return /*#__PURE__*/_jsxs(\"div\",{style:{width:\"100%\",padding:\"3rem\",textAlign:\"center\",color:C_BODY},children:[/*#__PURE__*/_jsx(\"h1\",{style:{color:C_HEADING},children:\"Post not found\"}),/*#__PURE__*/_jsx(\"p\",{children:/*#__PURE__*/_jsx(\"a\",{href:\"/blog\",style:{color:C_SUBTLE},children:\"← Back to blog\"})})]});}return /*#__PURE__*/_jsx(\"div\",{style:{width:\"100%\",height:\"100%\",overflowY:\"auto\"},children:/*#__PURE__*/_jsxs(\"article\",{style:{width:\"100%\",maxWidth:\"750px\",margin:\"0 auto\",padding:\"2rem 0\",color:C_BODY},children:[/*#__PURE__*/_jsxs(\"header\",{style:{marginBottom:\"2rem\"},children:[/*#__PURE__*/_jsx(\"h1\",{style:{fontSize:\"2rem\",lineHeight:1.2,marginBottom:\"0.75rem\",color:C_HEADING},children:post.title}),post.tagline&&/*#__PURE__*/_jsx(\"p\",{style:{fontSize:\"1.1rem\",color:C_SUBTLE,marginBottom:\"0.75rem\"},children:post.tagline}),/*#__PURE__*/_jsxs(\"div\",{style:{fontSize:\"0.85rem\",color:C_META},children:[formatDate(post.published_at),post.tags&&post.tags.length>0&&/*#__PURE__*/_jsxs(\"span\",{children:[\" \\xb7 \",post.tags.join(\" \\xb7 \")]})]})]}),post.thumbnail_1_url&&/*#__PURE__*/_jsxs(\"figure\",{style:{margin:\"0 0 2rem\"},children:[/*#__PURE__*/_jsx(\"img\",{src:post.thumbnail_1_url,alt:post.thumbnail_1_alt||post.title,style:{width:\"100%\",borderRadius:\"12px\"}}),post.thumbnail_1_attr&&/*#__PURE__*/_jsx(\"figcaption\",{style:{fontSize:\"0.8rem\",color:C_META,marginTop:\"0.5rem\",textAlign:\"center\"},children:post.thumbnail_1_attr})]}),/*#__PURE__*/_jsx(\"div\",{style:{fontSize:\"1.05rem\",lineHeight:1.8,color:C_BODY},dangerouslySetInnerHTML:{__html:post.body.replace(/\\n/g,\"<br>\")}})]})});}// Framer property controls\nexport const propertyControls={};\nexport const __FramerMetadata__ = {\"exports\":{\"propertyControls\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"BlogPost\":{\"type\":\"reactComponent\",\"name\":\"BlogPost\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"BlogList\":{\"type\":\"reactComponent\",\"name\":\"BlogList\",\"slots\":[],\"annotations\":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