import Game from '@/components/Game'; import NewsSection from '@/components/NewsSection'; import OnboardingTour from '@/components/OnboardingTour'; import LanguageSwitcher from '@/components/LanguageSwitcher'; import { getOrCreateDailyPuzzle } from '@/lib/dailyPuzzle'; import { Link } from '@/lib/navigation'; import { PrismaClient } from '@prisma/client'; import { getTranslations } from 'next-intl/server'; import { getLocalizedValue } from '@/lib/i18n'; export const dynamic = 'force-dynamic'; const prisma = new PrismaClient(); export default async function Home({ params }: { params: { locale: string }; }) { const { locale } = await params; const t = await getTranslations('Home'); const tNav = await getTranslations('Navigation'); const dailyPuzzle = await getOrCreateDailyPuzzle(null); // Global puzzle const genres = await prisma.genre.findMany({ where: { active: true }, }); const specials = await prisma.special.findMany(); // Sort in memory genres.sort((a, b) => getLocalizedValue(a.name, locale).localeCompare(getLocalizedValue(b.name, locale))); specials.sort((a, b) => getLocalizedValue(a.name, locale).localeCompare(getLocalizedValue(b.name, locale))); const now = new Date(); const activeSpecials = specials.filter(s => { const isStarted = !s.launchDate || s.launchDate <= now; const isEnded = s.endDate && s.endDate < now; return isStarted && !isEnded; }); const upcomingSpecials = specials.filter(s => { return s.launchDate && s.launchDate > now; }); return ( <>