From 76d10e1ab76e04acd08d442e7ef7d66d9c4fcbab Mon Sep 17 00:00:00 2001 From: development Date: Fri, 6 Feb 2026 17:54:01 +0000 Subject: [PATCH] Update src/app/blog/page.tsx --- src/app/blog/page.tsx | 121 ++++++++++++++++++++++-------------------- 1 file changed, 63 insertions(+), 58 deletions(-) diff --git a/src/app/blog/page.tsx b/src/app/blog/page.tsx index e6d71ce..2477f2a 100644 --- a/src/app/blog/page.tsx +++ b/src/app/blog/page.tsx @@ -54,7 +54,8 @@ export default function BlogPage() { const url = `${apiUrl}/posts/${projectId}?status=published`; const response = await fetch(url, { method: "GET", headers: { - "Content-Type": "application/json"}, + "Content-Type": "application/json" + }, }); if (response.ok) { @@ -63,7 +64,7 @@ export default function BlogPage() { if (Array.isArray(data) && data.length > 0) { const mappedPosts = data.map((post: any) => ({ id: post.id || String(Math.random()), - category: post.category || "General", title: post.title || "Untitled", excerpt: post.excerpt || post.content.slice(0, 30) || "", imageSrc: post.imageUrl || "/placeholders/placeholder3.avif", imageAlt: post.imageAlt || post.title || "", authorName: post.author?.name || "Anonymous", authorAvatar: post.author?.avatar || "/placeholders/placeholder3.avif", date: post.date || post.createdAt || new Date().toLocaleDateString("en-GB", { day: "numeric", month: "short", year: "numeric" }), + category: post.category || "General", title: post.title || "Untitled", excerpt: post.excerpt || post.content?.slice(0, 30) || "", imageSrc: post.imageUrl || "/placeholders/placeholder3.avif", imageAlt: post.imageAlt || post.title || "", authorName: post.author?.name || "Anonymous", authorAvatar: post.author?.avatar || "/placeholders/placeholder3.avif", date: post.date || post.createdAt || new Date().toLocaleDateString("en-GB", { day: "numeric", month: "short", year: "numeric" }), onBlogClick: () => console.log(`Blog ${post.id} clicked`), })); setPosts(mappedPosts); @@ -96,70 +97,74 @@ export default function BlogPage() { >
- + {isLoading ? (

Loading posts...

) : ( - +
+ +
)} - +