2024-03-19 14:49:50 -06:00

60 lines
1.3 KiB
TypeScript

import { prisma } from "@/prisma/prismaClient";
import Link from "next/link";
export default async function GameSystem(
{ params: { id } }: { params: { id: string } },
) {
if (!id) throw "HOW DID YOU GET HERE?";
const gameSystem = await prisma.gameSystem.findFirst({
where: {
id,
},
select: {
id: true,
name: true,
schemas: {
select: {
name: true,
id: true,
publications: {
select: {
name: true,
id: true,
},
},
},
},
},
});
return (
<>
<section className="heading">
<h2 className="strapline">Game System</h2>
<h1>{gameSystem?.name}</h1>
</section>
<section>
<>
<div>
<Link
className="btn-primary mb-6 block w-min whitespace-nowrap"
href={`/game-systems/${id}/schema/create`}
>
Create New Schema
</Link>
</div>
<ul>
{gameSystem?.schemas.map((schema) => (
<li key={schema.id}>{schema.name}</li>
))}
{!gameSystem?.schemas.length && (
<li>No schemas for {gameSystem?.name}</li>
)}
</ul>
</>
</section>
</>
);
}