'use client' import { useEffect, useState } from 'react' 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 { BookOpen, Calendar, Clock, Eye, ArrowRight, Loader2, FileText, TrendingUp, } from 'lucide-react' import clsx from 'clsx' interface BlogPost { id: number title: string slug: string excerpt: string | null cover_image: string | null category: string | null tags: string[] is_published: boolean published_at: string | null created_at: string view_count: number author: { id: number name: string | null } } interface Category { name: string count: number } export default function BlogPage() { const [posts, setPosts] = useState([]) const [categories, setCategories] = useState([]) const [loading, setLoading] = useState(true) const [selectedCategory, setSelectedCategory] = useState(null) const [total, setTotal] = useState(0) useEffect(() => { loadBlogData() }, [selectedCategory]) const loadBlogData = async () => { setLoading(true) try { const [postsData, categoriesData] = await Promise.all([ api.getBlogPosts(12, 0, selectedCategory || undefined), api.getBlogCategories(), ]) setPosts(postsData.posts) setTotal(postsData.total) setCategories(categoriesData.categories) } catch (error) { console.error('Failed to load blog:', error) } finally { setLoading(false) } } const formatDate = (dateString: string) => { return new Date(dateString).toLocaleDateString('en-US', { year: 'numeric', month: 'short', day: 'numeric', }) } const estimateReadTime = (excerpt: string | null) => { if (!excerpt) return '3 min' const words = excerpt.split(' ').length const minutes = Math.ceil(words / 200) + 2 return `${minutes} min` } const featuredPost = posts[0] const otherPosts = posts.slice(1) return (
{/* Background Effects */}
{/* Hero Header */}
Field Briefings

The Hunt
Begins Here.

Expert strategies, market insights, and proven tactics from professional domain hunters.

{/* Categories */} {categories.length > 0 && (
{categories.map((cat) => ( ))}
)} {/* Posts */} {loading ? (

Loading insights...

) : posts.length === 0 ? (

Coming Soon

We're preparing expert content. Check back soon for domain hunting insights and strategies.

) : ( <> {/* Featured Post */} {featuredPost && !selectedCategory && (
{/* Image */}
{featuredPost.cover_image ? ( {featuredPost.title} ) : (
)}
{/* Featured Badge */}
Featured
{/* Content */}
{featuredPost.category && ( {featuredPost.category} )}

{featuredPost.title}

{featuredPost.excerpt && (

{featuredPost.excerpt}

)}
{featuredPost.published_at ? formatDate(featuredPost.published_at) : formatDate(featuredPost.created_at)} {estimateReadTime(featuredPost.excerpt)} {featuredPost.view_count}
Read Article
)} {/* Posts Grid */}
{(selectedCategory ? posts : otherPosts).map((post, index) => ( {/* Cover */}
{post.cover_image ? ( {post.title} ) : (
)}
{post.category && ( {post.category} )}
{/* Content */}

{post.title}

{post.excerpt && (

{post.excerpt}

)}
{post.published_at ? formatDate(post.published_at) : formatDate(post.created_at)} {post.view_count}
))}
{/* Load More */} {posts.length < total && (
)} )} {/* Newsletter CTA */}

Get hunting tips in your inbox

Join domain hunters who receive weekly insights, market trends, and exclusive strategies.

) }