'use client' import { useEffect, useState } from 'react' import { useParams, useRouter } from 'next/navigation' import Link from 'next/link' import Image from 'next/image' import { Header } from '@/components/Header' import { Footer } from '@/components/Footer' import { api } from '@/lib/api' import { Calendar, Clock, Eye, ArrowLeft, Tag, Loader2, User, Share2, BookOpen, } from 'lucide-react' interface BlogPost { id: number title: string slug: string excerpt: string | null content: string cover_image: string | null category: string | null tags: string[] meta_title: string | null meta_description: string | null is_published: boolean published_at: string | null created_at: string updated_at: string view_count: number author: { id: number name: string | null } } export default function BlogPostPage() { const params = useParams() const router = useRouter() const slug = params.slug as string const [post, setPost] = useState(null) const [loading, setLoading] = useState(true) const [error, setError] = useState(null) useEffect(() => { if (slug) { loadPost() } }, [slug]) const loadPost = async () => { setLoading(true) setError(null) try { const data = await api.getBlogPost(slug) setPost(data) } catch (err) { setError('Blog post not found') } finally { setLoading(false) } } const formatDate = (dateString: string) => { return new Date(dateString).toLocaleDateString('en-US', { year: 'numeric', month: 'long', day: 'numeric', }) } const estimateReadTime = (content: string) => { const words = content.split(/\s+/).length const minutes = Math.ceil(words / 200) return `${minutes} min read` } const handleShare = async () => { if (navigator.share) { try { await navigator.share({ title: post?.title, url: window.location.href, }) } catch (err) { // User cancelled or error } } else { // Fallback: copy to clipboard navigator.clipboard.writeText(window.location.href) } } if (loading) { return (
) } if (error || !post) { return (

Post Not Found

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

Back to Blog
) } return (
{/* Background Effects */}
{/* Back Link */} Back to Blog {/* Header */}
{post.category && ( {post.category} )}

{post.title}

{/* Meta */}
{post.author.name && ( {post.author.name} )} {post.published_at ? formatDate(post.published_at) : formatDate(post.created_at)} {estimateReadTime(post.content)} {post.view_count} views
{/* Cover Image */} {post.cover_image && (
{post.title}
)} {/* Content */}
{/* Tags */} {post.tags.length > 0 && (
{post.tags.map((tag) => ( {tag} ))}
)} {/* CTA */}

Ready to start hunting domains?

Join thousands of domain hunters using pounce to find and secure premium domains.

Get Started Free
) }