From 3a6fe133da16c04efa0fa00f77c84c57c69acec6 Mon Sep 17 00:00:00 2001 From: Jorge Vargas Date: Mon, 23 Jun 2025 14:34:32 -0600 Subject: [PATCH] Add series field to game album pages --- src/pages/album/[id].astro | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/pages/album/[id].astro b/src/pages/album/[id].astro index 2264834..28e58ec 100644 --- a/src/pages/album/[id].astro +++ b/src/pages/album/[id].astro @@ -35,7 +35,7 @@ const album = await prismaClient.albums.findUnique({ categories: { select: { categoryName: true } }, classifications: { select: { classificationName: true } }, platforms: { select: { platform: { select: { id: true, name: true } } } }, - games: { select: { game: { select: { slug: true, name: true } } } }, + games: { select: { game: { select: { slug: true, name: true,series: {select: {series: {select: {slug: true, name: true}}}} } } } }, animations: { select: { animation: { select: { id: true, title: true } } } }, stores: { select: { url: true, provider: true }, where: { NOT: { provider: 'SOON' } } }, discs: { select: { number: true, body: true } }, @@ -51,6 +51,7 @@ const album = await prismaClient.albums.findUnique({ if (!album) return Astro.redirect("/404"); +const series = album.games.map(g => g.game.series).flat().map(s => s.series) const { currentLocale } = Astro const coverImage = await getImage({ src: `https://cdn.sittingonclouds.net/album/${album?.id}.png`, @@ -197,6 +198,23 @@ const coverImage = await getImage({ ) } + { + series.length > 0 && ( + + {m.series()} + + {series.map((s, i) => ( + + + {s.name} + + {i !== series.length - 1 && ', '} + + ))} + + + ) + } { (album?.games.length ?? 0) > 0 && (