30 lines
1.0 KiB
TypeScript
30 lines
1.0 KiB
TypeScript
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();
|
|
|
|
export default async function Home() {
|
|
const dailyPuzzle = await getOrCreateDailyPuzzle(null); // Global puzzle
|
|
const genres = await prisma.genre.findMany({ orderBy: { name: 'asc' } });
|
|
|
|
return (
|
|
<>
|
|
<div style={{ textAlign: 'center', padding: '1rem', background: '#f3f4f6' }}>
|
|
<div style={{ display: 'flex', justifyContent: 'center', gap: '1rem', flexWrap: 'wrap' }}>
|
|
<Link href="/" style={{ fontWeight: 'bold', textDecoration: 'underline' }}>Global</Link>
|
|
{genres.map(g => (
|
|
<Link key={g.id} href={`/${g.name}`} style={{ color: '#4b5563', textDecoration: 'none' }}>
|
|
{g.name}
|
|
</Link>
|
|
))}
|
|
</div>
|
|
</div>
|
|
<Game dailyPuzzle={dailyPuzzle} genre={null} />
|
|
</>
|
|
);
|
|
}
|