diff --git a/src/app/[game]/page.tsx b/src/app/[game]/page.tsx new file mode 100644 index 0000000..b1d0d19 --- /dev/null +++ b/src/app/[game]/page.tsx @@ -0,0 +1,33 @@ +import { notFound } from "next/navigation"; +import { getAllGames, getGame } from "@/lib/content"; +import BookCover from "@/components/BookCover"; + +interface PageProps { + params: { game: string }; +} + +export async function generateStaticParams() { + const games = getAllGames(); + return games.map((game) => ({ game: game.slug })); +} + +export async function generateMetadata({ params }: PageProps) { + try { + const game = getGame(params.game); + return { + title: `${game.title} | Cronicas de los Reinos`, + description: game.description, + }; + } catch { + return { title: "No encontrado" }; + } +} + +export default function GamePage({ params }: PageProps) { + try { + const game = getGame(params.game); + return ; + } catch { + notFound(); + } +} diff --git a/src/components/BookCover.tsx b/src/components/BookCover.tsx new file mode 100644 index 0000000..bb3dcd0 --- /dev/null +++ b/src/components/BookCover.tsx @@ -0,0 +1,91 @@ +import Link from "next/link"; +import { GameWithChapters } from "@/types"; + +export default function BookCover({ game }: { game: GameWithChapters }) { + return ( +
+ {/* Back to shelf */} +
+ + Volver a la estanteria + +
+ + {/* Cover */} +
+ {/* Decorative top */} +
+ +

+ {game.title} +

+ +

+ {game.subtitle} +

+ + {/* Decorative divider */} +
+
+
+
+
+ +

+ {game.description} +

+ + {/* Table of Contents */} +
+

+ Indice +

+ +
+ {game.chapters.map((chapter) => ( + + + {String(chapter.number).padStart(2, "0")} + + + {chapter.title} + + + → + + + ))} +
+
+ + {/* Decorative bottom */} +
+
+
+ ); +}