"use client"; import { useParams } from "next/navigation"; import Image from "next/legacy/image"; import Link from "next/link"; import { useBlogPost } from "@/lib/hooks/useBlog"; import { getValidImageUrl, getValidImageAlt, FALLBACK_IMAGES } from "@/lib/imageUtils"; const BlogSingle = () => { const params = useParams(); const slug = params?.slug as string; const { post, loading, error } = useBlogPost(slug); if (loading) { return (
Loading...

Loading insight...

); } if (error || !post) { return (

Insight Not Found

The insight you're looking for doesn't exist or has been removed.

Back to Insights
); } return (
{/* Article Content */}
{/* Article Header */}
{/* Top Meta Bar */}
{/* Category Badge */} {post.category && ( {post.category.title} )} {/* Date */}
{new Date(post.published_at || post.created_at).toLocaleDateString('en-US', { day: 'numeric', month: 'short', year: 'numeric' })}
{/* Reading Time */}
{post.reading_time} min
{/* Views */}
{post.views_count}
{/* Title */}

{post.title}

{/* Author and Tags Bar */}
{/* Author */}
{post.author?.avatar ? ( {post.author.name} ) : (
)}
Written by
{post.author?.name || post.author_name || 'Admin'}
{/* Tags */} {post.tags && post.tags.length > 0 && (
{post.tags.map((tag) => ( #{tag.name} ))}
)}
{/* Featured Image */} {(post.featured_image || post.thumbnail) && (
{getValidImageAlt(post.title)}
)} {/* Article Body */}
{/* Excerpt */} {post.excerpt && (

{post.excerpt}

)} {/* Content */} {post.content && (
)}
{/* Footer Section */}
); }; export default BlogSingle;