'use client'; import { useEffect, useRef } from 'react'; import Link from 'next/link'; import { useRouter } from 'next/navigation'; import Navigation from '../../../../components/Navigation'; import FloatingLanguageSwitcher from '../../../../components/FloatingLanguageSwitcher'; import Footer from '../../../../components/Footer'; import { Locale } from '../../../../lib/i18n'; import { getTranslations, Translations } from '../../../../lib/translations'; import { updateDocumentMeta } from '../../../../lib/seo-utils'; // Gentle Particle Background Component function GentleParticleBackground() { const canvasRef = useRef(null); useEffect(() => { const canvas = canvasRef.current; if (!canvas) return; const ctx = canvas.getContext('2d'); if (!ctx) return; // Set canvas size const resizeCanvas = () => { canvas.width = window.innerWidth; canvas.height = window.innerHeight; }; resizeCanvas(); window.addEventListener('resize', resizeCanvas); // Gentle particle system const particles: Array<{ x: number; y: number; vx: number; vy: number; size: number; opacity: number; }> = []; // Create particles for (let i = 0; i < 60; i++) { particles.push({ x: Math.random() * canvas.width, y: Math.random() * canvas.height, vx: (Math.random() - 0.5) * 0.2, vy: (Math.random() - 0.5) * 0.2, size: Math.random() * 2 + 1, opacity: Math.random() * 0.3 + 0.1, }); } // Animation loop const animate = () => { ctx.clearRect(0, 0, canvas.width, canvas.height); particles.forEach((particle) => { // Update position particle.x += particle.vx; particle.y += particle.vy; // Wrap around edges if (particle.x < 0) particle.x = canvas.width; if (particle.x > canvas.width) particle.x = 0; if (particle.y < 0) particle.y = canvas.height; if (particle.y > canvas.height) particle.y = 0; // Draw particle ctx.beginPath(); ctx.arc(particle.x, particle.y, particle.size, 0, Math.PI * 2); ctx.fillStyle = `rgba(255, 255, 255, ${particle.opacity})`; ctx.fill(); }); requestAnimationFrame(animate); }; animate(); return () => { window.removeEventListener('resize', resizeCanvas); }; }, []); return ( ); } type Post = Translations['blog']['posts']['featured']; // Assuming all posts have the same structure export default function BlogPostClient({ locale, post, t, }: { locale: Locale; post: Post | null; t: Translations; }) { const router = useRouter(); // Update meta tags when locale changes useEffect(() => { updateDocumentMeta(locale); }, [locale]); if (!post) { return (

Post Not Found

Back to Blog
); } const getCategoryColor = (category: string) => { switch (category) { case 'playerStories': return 'bg-amber-500'; case 'development': return 'bg-green-500'; case 'ecoFacts': return 'bg-emerald-500'; default: return 'bg-blue-500'; } }; const getCategoryName = (category: string) => { switch (category) { case 'playerStories': return t.blog.categories.playerStories; case 'development': return t.blog.categories.development; case 'ecoFacts': return t.blog.categories.ecoFacts; default: return category; } }; return (
{/* Gentle Background with Overlay */}
')`, }} /> {/* Gentle Particle Background */} {/* Navigation */} {/* Floating Language Switcher */} {/* Article Content */}
{/* Back to Blog Link */}
{t.blog.backToBlog}
{/* Article Header */}
{getCategoryName(post.category)}

{post.title}

{post.author}
{post.date}
{post.readTime}

{post.excerpt}

{/* Article Body */}
{post.content.split('\n\n').map((paragraph, index) => (

{paragraph}

))}
{/* Article Footer */}
{post.author.charAt(0)}

{post.author}

Environmental Writer

{/* Related Posts Section */}

Related Posts

Player Spotlight: Building a Virtual Eco-City

Meet Alex, a player who created an incredible sustainable city...

10 Amazing Facts About Ocean Conservation

Dive into fascinating facts about our oceans...

{/* Footer */}
); }