feat: build game detail page with header, info panel, and screenshot gallery
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
35
apps/web/src/app/[locale]/games/[slug]/page.tsx
Normal file
35
apps/web/src/app/[locale]/games/[slug]/page.tsx
Normal file
@@ -0,0 +1,35 @@
|
||||
import { notFound } from "next/navigation";
|
||||
import { getGameBySlug } from "@/lib/api";
|
||||
import { GameHeader } from "@/components/game/GameHeader";
|
||||
import { GameInfo } from "@/components/game/GameInfo";
|
||||
import { ScreenshotGallery } from "@/components/game/ScreenshotGallery";
|
||||
|
||||
export default async function GamePage({
|
||||
params,
|
||||
}: {
|
||||
params: Promise<{ locale: string; slug: string }>;
|
||||
}) {
|
||||
const { locale, slug } = await params;
|
||||
|
||||
let game;
|
||||
try {
|
||||
const res = await getGameBySlug(slug, locale);
|
||||
game = Array.isArray(res.data) ? res.data[0] : res.data;
|
||||
} catch {
|
||||
notFound();
|
||||
}
|
||||
|
||||
if (!game) notFound();
|
||||
|
||||
return (
|
||||
<>
|
||||
<GameHeader game={game} />
|
||||
<div className="max-w-7xl mx-auto px-4 py-12">
|
||||
<GameInfo game={game} locale={locale} />
|
||||
{game.screenshots && (
|
||||
<ScreenshotGallery screenshots={game.screenshots} />
|
||||
)}
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user