import Game from '@/components/Game'; import NewsSection from '@/components/NewsSection'; import { getOrCreateSpecialPuzzle } from '@/lib/dailyPuzzle'; import { Link } from '@/lib/navigation'; import { PrismaClient } from '@prisma/client'; import { getLocalizedValue } from '@/lib/i18n'; import { getTranslations } from 'next-intl/server'; export const dynamic = 'force-dynamic'; const prisma = new PrismaClient(); interface PageProps { params: Promise<{ locale: string; name: string }>; } export default async function SpecialPage({ params }: PageProps) { const { locale, name } = await params; const decodedName = decodeURIComponent(name); const tNav = await getTranslations('Navigation'); const allSpecials = await prisma.special.findMany(); const currentSpecial = allSpecials.find(s => getLocalizedValue(s.name, locale) === decodedName); const now = new Date(); const isStarted = currentSpecial && (!currentSpecial.launchDate || currentSpecial.launchDate <= now); const isEnded = currentSpecial && (currentSpecial.endDate && currentSpecial.endDate < now); if (!currentSpecial || !isStarted) { return (
This special has not launched yet or does not exist.
{tNav('home')}This special event has ended.
{tNav('home')}