'use client'; import { useState, useRef } from 'react'; import { useTranslations } from 'next-intl'; import { Link } from '@/i18n/navigation'; import { motion, useInView } from 'framer-motion'; import { Ship, BookOpen, Calendar, Clock, User, ArrowRight, Search, TrendingUp, Globe, FileText, Anchor, type LucideIcon, } from 'lucide-react'; import { LandingHeader, LandingFooter } from '@/components/layout'; type CategoryKey = 'all' | 'industry' | 'technology' | 'guides' | 'news'; type ArticleKey = 'incoterms' | 'costs' | 'ports' | 'funding' | 'green' | 'api' | 'documents'; const CATEGORIES: { key: CategoryKey; icon: LucideIcon }[] = [ { key: 'all', icon: BookOpen }, { key: 'industry', icon: Ship }, { key: 'technology', icon: TrendingUp }, { key: 'guides', icon: FileText }, { key: 'news', icon: Globe }, ]; const ARTICLES: { id: number; key: ArticleKey; category: Exclude; tags: string[] }[] = [ { id: 2, key: 'incoterms', category: 'guides', tags: ['Incoterms', 'Guide', 'Commerce'] }, { id: 3, key: 'costs', category: 'guides', tags: ['Optimisation', 'Costs', 'Strategy'] }, { id: 4, key: 'ports', category: 'industry', tags: ['Ports', 'Europe', 'Stats'] }, { id: 5, key: 'funding', category: 'news', tags: ['Funding', 'Growth', 'Xpeditis'] }, { id: 6, key: 'green', category: 'industry', tags: ['Environment', 'Decarbonization', 'Sustainability'] }, { id: 7, key: 'api', category: 'technology', tags: ['API', 'Integration', 'Technical'] }, { id: 8, key: 'documents', category: 'guides', tags: ['Documents', 'Export', 'Customs'] }, ]; export default function BlogPage() { const t = useTranslations('marketing.blog'); const [selectedCategory, setSelectedCategory] = useState('all'); const [searchQuery, setSearchQuery] = useState(''); const heroRef = useRef(null); const articlesRef = useRef(null); const categoriesRef = useRef(null); const isHeroInView = useInView(heroRef, { once: true }); const isArticlesInView = useInView(articlesRef, { once: true }); const isCategoriesInView = useInView(categoriesRef, { once: true }); const filteredArticles = ARTICLES.filter((article) => { const categoryMatch = selectedCategory === 'all' || article.category === selectedCategory; const title = t(`articles.${article.key}.title` as any); const excerpt = t(`articles.${article.key}.excerpt` as any); const searchMatch = searchQuery === '' || title.toLowerCase().includes(searchQuery.toLowerCase()) || excerpt.toLowerCase().includes(searchQuery.toLowerCase()); return categoryMatch && searchMatch; }); const containerVariants = { hidden: { opacity: 0, y: 50 }, visible: { opacity: 1, y: 0, transition: { duration: 0.6, staggerChildren: 0.1, }, }, }; const itemVariants = { hidden: { opacity: 0, y: 20 }, visible: { opacity: 1, y: 0, transition: { duration: 0.5 }, }, }; return (
{/* Hero Section */}
{t('badge')}

{t('title1')}
{t('title2')}

{t('intro')}

{/* Search Bar */}
setSearchQuery(e.target.value)} className="w-full pl-12 pr-4 py-4 rounded-xl bg-white text-gray-900 placeholder-gray-400 focus:ring-2 focus:ring-brand-turquoise focus:outline-none" />
{/* Wave */}
{/* Categories */}
{CATEGORIES.map((category) => { const IconComponent = category.icon; const isActive = selectedCategory === category.key; return ( ); })}
{/* Featured Article */}
{t('featuredBadge')} {t('categories.technology')}

{t('featured.title')}

{t('featured.excerpt')}

{t('featured.author')}
{t('featured.date')}
{t('featured.readTime')}
{t('readArticle')}
{/* Articles Grid */}

{t('allTitle')}

{t('articlesCount', { count: filteredArticles.length })}
{filteredArticles.length === 0 ? (

{t('noResults.title')}

{t('noResults.body')}

) : ( {filteredArticles.map((article) => (
{t(`categories.${article.category}`)}

{t(`articles.${article.key}.title` as any)}

{t(`articles.${article.key}.excerpt` as any)}

{article.tags.map((tag) => ( {tag} ))}
{t(`articles.${article.key}.author` as any)}
{t(`articles.${article.key}.date` as any)} {t(`articles.${article.key}.readTime` as any)}
))}
)} {/* Load More */} {filteredArticles.length > 0 && ( )}
{/* Newsletter Section */}

{t('newsletter.title')}

{t('newsletter.body')}

{t('newsletter.disclaimer')}

); }