diff --git a/astro.config.mjs b/astro.config.mjs index 9e4df65..c336deb 100644 --- a/astro.config.mjs +++ b/astro.config.mjs @@ -49,7 +49,6 @@ export default defineConfig({ adapter: node({ mode: 'standalone' }), redirects: { '/en/[...params]': '/[...params]', - '/game/[slug]': { status: 307, destination: '/maintenance' }, '/platform/[id]': { status: 307, destination: '/maintenance' }, '/profile': { status: 307, destination: '/maintenance' }, '/profile/[username]': { status: 307, destination: '/maintenance' }, diff --git a/src/pages/game/[slug].astro b/src/pages/game/[slug].astro new file mode 100644 index 0000000..09ae69e --- /dev/null +++ b/src/pages/game/[slug].astro @@ -0,0 +1,146 @@ +--- +import prismaClient from 'utils/prisma-client' +import * as m from 'paraglide/messages' +import { getImage, Image } from 'astro:assets' +import { SEO } from 'astro-seo' + +import BaseLayout from 'layouts/base.astro' + +import AlbumBox from 'components/AlbumBox.astro' +import releaseDate from 'utils/releaseDate' + +const { slug } = Astro.params +if (!slug) return Astro.redirect('/404') + +const game = await prismaClient.game.findUnique({ + where: { slug }, + select: { + name: true, + releaseDate: true, + publishers: { select: { publisher: { select: { name: true, id: true } } } }, + platforms: { select: { platform: { select: { name: true, id: true } } } }, + series: { select: { series: { select: { name: true, slug: true } } } }, + headerColor: true, + albums: { + select: { game: true, album: { select: { games: true, id: true, title: true, publishedAt: true } } }, + orderBy: { album: { publishedAt: 'desc' } } + } + } +}) + +if (!game) return Astro.redirect('/404') + +const { currentLocale } = Astro +const coverImage = await getImage({ + src: `https://cdn.sittingonclouds.net/game/${slug}.png`, + height: 150, + width: 150 +}) +--- + + s.series.name).join(' - ')}${game.series.length > 0 ? ' / ' : ''}${game.publishers.map((p) => p.publisher.name).join(' - ')}`, + siteName: 'Sitting on Clouds' + } + }} + extend={{ + meta: [{ name: 'theme-color', content: game.headerColor ?? '#121212' }] + }} +/> + + +
+
+
+
+ +
+
+
+
+
{game.name}
+ + + { + game.releaseDate ? ( + + + + + ) : null + } + + + + + + + + + + + + + +
{m.releaseDate()}:{releaseDate(game.releaseDate)}
{m.publishers()}:{ + game.publishers.map((p, i) => ( + <> + {p.publisher.name} + {i < game.publishers.length - 1 ? - : null} + + )) + }
{m.platforms()}:{ + game.platforms.map((p, i) => ( + <> + {p.platform.name} + {i < game.platforms.length - 1 ? - : null} + + )) + }
{m.series()}:{ + game.series.map((p, i) => ( + <> + {p.series.name} + {i < game.series.length - 1 ? - : null} + + )) + }
+
+
+
+
+
+
+ { + game.albums.map((a) => ( + + )) + } +
+
+
+