import Game from '@/components/Game'; import { getOrCreateDailyPuzzle } from '@/lib/dailyPuzzle'; import Link from 'next/link'; import { PrismaClient } from '@prisma/client'; export const dynamic = 'force-dynamic'; const prisma = new PrismaClient(); interface PageProps { params: Promise<{ genre: string }>; } export default async function GenrePage({ params }: PageProps) { const { genre } = await params; const decodedGenre = decodeURIComponent(genre); const dailyPuzzle = await getOrCreateDailyPuzzle(decodedGenre); const genres = await prisma.genre.findMany({ orderBy: { name: 'asc' } }); const specials = await prisma.special.findMany({ orderBy: { name: 'asc' } }); 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 ( <>