import Game from '@/components/Game'; import NewsSection from '@/components/NewsSection'; import OnboardingTour from '@/components/OnboardingTour'; import { getOrCreateDailyPuzzle } from '@/lib/dailyPuzzle'; import Link from 'next/link'; import { PrismaClient } from '@prisma/client'; export const dynamic = 'force-dynamic'; const prisma = new PrismaClient(); export default async function Home() { const dailyPuzzle = await getOrCreateDailyPuzzle(null); // Global puzzle const genres = await prisma.genre.findMany({ where: { active: true }, 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 ( <>
Global A random song from the entire collection
{/* Genres */} {genres.map(g => (
{g.name} {g.subtitle && {g.subtitle}}
))} {/* Separator if both exist */} {genres.length > 0 && activeSpecials.length > 0 && ( | )} {/* Active Specials */} {activeSpecials.map(s => (
★ {s.name} {s.subtitle && {s.subtitle}}
{s.curator && ( Curated by {s.curator} )}
))}
{/* Upcoming Specials */} {upcomingSpecials.length > 0 && (
Coming soon: {upcomingSpecials.map(s => ( ★ {s.name} ({s.launchDate ? new Date(s.launchDate).toLocaleDateString('de-DE', { day: '2-digit', month: '2-digit', year: 'numeric', timeZone: process.env.TZ }) : ''}) {s.curator && Curated by {s.curator}} ))}
)}
); }