diff --git a/astro.config.mjs b/astro.config.mjs index 966c2b1..c336deb 100644 --- a/astro.config.mjs +++ b/astro.config.mjs @@ -49,15 +49,11 @@ export default defineConfig({ adapter: node({ mode: 'standalone' }), redirects: { '/en/[...params]': '/[...params]', - '/anim/[id]': { status: 307, destination: '/maintenance' }, - '/game/[slug]': { status: 307, destination: '/maintenance' }, - '/platform/list': { status: 307, destination: '/maintenance' }, '/platform/[id]': { status: 307, destination: '/maintenance' }, '/profile': { status: 307, destination: '/maintenance' }, '/profile/[username]': { status: 307, destination: '/maintenance' }, '/series/[slug]': { status: 307, destination: '/maintenance' }, '/studio/[slug]': { status: 307, destination: '/maintenance' }, - '/studio/list': { status: 307, destination: '/maintenance' }, '/request': { status: 307, destination: '/maintenance' } }, security: { diff --git a/src/components/Header.astro b/src/components/Header.astro index ef148ec..2e4d5c5 100644 --- a/src/components/Header.astro +++ b/src/components/Header.astro @@ -62,7 +62,7 @@ const { session } = Astro.locals {m.gamelist()} {m.series()} {m.publishers()} - {m.platforms()} + {m.platforms()} diff --git a/src/components/albumPage/releaseDate.tsx b/src/components/albumPage/releaseDate.tsx deleted file mode 100644 index 250d1db..0000000 --- a/src/components/albumPage/releaseDate.tsx +++ /dev/null @@ -1,10 +0,0 @@ -const locale = - navigator && navigator.languages && navigator.languages.length ? navigator.languages[0] : navigator.language - -interface Props { - releaseDate: Date -} - -export default function ReleaseDate(props: Props) { - return {new Intl.DateTimeFormat(locale, { dateStyle: 'medium' }).format(props.releaseDate)} -} diff --git a/src/components/letterList/PlatformList.astro b/src/components/letterList/PlatformList.astro new file mode 100644 index 0000000..4721932 --- /dev/null +++ b/src/components/letterList/PlatformList.astro @@ -0,0 +1,21 @@ +--- +import prismaClient from 'utils/prisma-client' + +interface Props { + letter: string +} + +const { letter } = Astro.props +const games = await prismaClient.platform.findMany({ + where: { name: { startsWith: letter } }, + select: { id: true, name: true } +}) +--- + +{ + games.map((a) => ( + + {a.name} + + )) +} diff --git a/src/components/letterList/PublisherList.astro b/src/components/letterList/PublisherList.astro new file mode 100644 index 0000000..87875d8 --- /dev/null +++ b/src/components/letterList/PublisherList.astro @@ -0,0 +1,21 @@ +--- +import prismaClient from 'utils/prisma-client' + +interface Props { + letter: string +} + +const { letter } = Astro.props +const games = await prismaClient.publisher.findMany({ + where: { name: { startsWith: letter } }, + select: { id: true, name: true } +}) +--- + +{ + games.map((a) => ( + + {a.name} + + )) +} diff --git a/src/components/letterList/SeriesList.astro b/src/components/letterList/SeriesList.astro index 7f741d8..cae262e 100644 --- a/src/components/letterList/SeriesList.astro +++ b/src/components/letterList/SeriesList.astro @@ -15,7 +15,7 @@ const albums = await prismaClient.series.findMany({ { albums.map((a) => ( - + {a.name} )) diff --git a/src/components/letterList/SeriesListCover.astro b/src/components/letterList/SeriesListCover.astro index bb9ece6..58e114d 100644 --- a/src/components/letterList/SeriesListCover.astro +++ b/src/components/letterList/SeriesListCover.astro @@ -16,7 +16,7 @@ const albums = await prismaClient.series.findMany({ { albums.map((a) => ( - + {a.slug} ( + + {a.name} + + )) +} diff --git a/src/pages/album/[id].astro b/src/pages/album/[id].astro index 4582da8..687f974 100644 --- a/src/pages/album/[id].astro +++ b/src/pages/album/[id].astro @@ -9,6 +9,7 @@ import BaseLayout from 'layouts/base.astro' import TrackList from 'components/albumPage/TrackList' import DownloadBtn from 'components/albumPage/DownloadBtn.astro' import AlbumBox from 'components/AlbumBox.astro' +import releaseDate from 'utils/releaseDate' import kofi from 'img/socials/ko-fi-donate-button.png' import discord from 'img/socials/discord.png' @@ -130,7 +131,7 @@ const coverImage = await getImage({ {m.releaseDate()} - {new Intl.DateTimeFormat(currentLocale, { dateStyle: 'medium' }).format(album?.releaseDate)} + {releaseDate(album?.releaseDate)} ) : null diff --git a/src/pages/anim/[id].astro b/src/pages/anim/[id].astro new file mode 100644 index 0000000..1182a8c --- /dev/null +++ b/src/pages/anim/[id].astro @@ -0,0 +1,126 @@ +--- +import { SEO } from 'astro-seo' +import * as m from 'paraglide/messages' +import prismaClient from 'utils/prisma-client' +import { getImage } from 'astro:assets' +import { Image } from 'astro:assets' + +import BaseLayout from 'layouts/base.astro' +import AlbumBox from 'components/AlbumBox.astro' +import releaseDate from 'utils/releaseDate' + +const { id } = Astro.params + +if (!id) return Astro.redirect('/404') +const animId = parseInt(id) +if (!animId) return Astro.redirect('/404') + +const anim = await prismaClient.animation.findUnique({ + where: { id: animId }, + select: { + title: true, + subTitle: true, + releaseDate: true, + headerColor: true, + studios: { select: { studioSlug: true, studio: { select: { name: true } } } }, + albums: { select: { album: { select: { title: true, id: true } } } } + } +}) + +if (!anim) return Astro.redirect('/404') + +const coverImage = await getImage({ + src: `https://cdn.sittingonclouds.net/anim/${animId}.png`, + height: 150, + width: 150 +}) +const { currentLocale } = Astro +--- + + 0 + ? `${anim.subTitle} / ${anim.studios.map((a) => a.studio.name).join(' - ')}` + : anim.subTitle || anim.studios.map((a) => a.studio.name).join(' - '), + siteName: 'Sitting on Clouds' + } + }} + extend={{ + meta: [{ name: 'theme-color', content: anim.headerColor ?? '#ffffff' }] + }} +/> + + +
+
+
+
+
+ {`${anim.title} +
+
{anim.title}
+ {anim.subTitle ?
{anim.subTitle}
: null} +
+ { + anim.releaseDate ? ( +
+
{m.releaseDate()}
+
{releaseDate(anim.releaseDate)}
+
+ ) : null + } + { + anim.studios.length > 0 ? ( + <> +
+
{m.studios()}
+ +
+ {anim.studios.slice(1).map((a) => ( +
+
+ +
+ ))} + + ) : null + } +
+
+
+ { + anim.albums.map((a) => ( + + )) + } +
+
+
+
+ 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) => ( + + )) + } +
+
+
+
diff --git a/src/pages/platform/list/index.astro b/src/pages/platform/list/index.astro new file mode 100644 index 0000000..6a5f297 --- /dev/null +++ b/src/pages/platform/list/index.astro @@ -0,0 +1,36 @@ +--- +import prismaClient from 'utils/prisma-client' + +import LetterList from 'layouts/LetterList.astro' +import GameList from 'components/letterList/GameList.astro' +import PublisherList from 'components/letterList/PublisherList.astro' +import PlatformList from 'components/letterList/PlatformList.astro' + +const letters: { letter: string; count: BigInt }[] = await prismaClient.$queryRaw` + SELECT DISTINCT UPPER(LEFT(platform.name, 1)) AS letter, COUNT(*) AS count + FROM Album_Platform, albums, platform + WHERE Album_Platform.albumId = albums.id + AND Album_Platform.platformId = platform.id + GROUP BY letter + ORDER BY letter; +` +--- + + + { + letters.map((l) => ( +
+
{l.letter}
+
+ + + {Array.from({ length: Number(l.count) }).map(() => ( +
+ ))} + + +
+
+ )) + } + diff --git a/src/pages/publisher/list/index.astro b/src/pages/publisher/list/index.astro new file mode 100644 index 0000000..f02c82c --- /dev/null +++ b/src/pages/publisher/list/index.astro @@ -0,0 +1,35 @@ +--- +import prismaClient from 'utils/prisma-client' + +import LetterList from 'layouts/LetterList.astro' +import GameList from 'components/letterList/GameList.astro' +import PublisherList from 'components/letterList/PublisherList.astro' + +const letters: { letter: string; count: BigInt }[] = await prismaClient.$queryRaw` + SELECT DISTINCT UPPER(LEFT(publisher.name, 1)) AS letter, COUNT(*) AS count + FROM Publisher_Game, publisher, game + WHERE Publisher_Game.publisherId = publisher.id + AND Publisher_Game.gameSlug = game.slug + GROUP BY letter + ORDER BY letter; +` +--- + + + { + letters.map((l) => ( +
+
{l.letter}
+
+ + + {Array.from({ length: Number(l.count) }).map(() => ( +
+ ))} + + +
+
+ )) + } + diff --git a/src/pages/studio/list/index.astro b/src/pages/studio/list/index.astro new file mode 100644 index 0000000..8cb35d4 --- /dev/null +++ b/src/pages/studio/list/index.astro @@ -0,0 +1,35 @@ +--- +import prismaClient from 'utils/prisma-client' + +import LetterList from 'layouts/LetterList.astro' +import GameList from 'components/letterList/GameList.astro' +import PublisherList from 'components/letterList/PublisherList.astro' + +const letters: { letter: string; count: BigInt }[] = await prismaClient.$queryRaw` + SELECT DISTINCT UPPER(LEFT(studio.name, 1)) AS letter, COUNT(*) AS count + FROM Studio_Animation, studio, animation + WHERE Studio_Animation.animationId = animation.id + AND Studio_Animation.studioSlug = studio.slug + GROUP BY letter + ORDER BY letter; +` +--- + + + { + letters.map((l) => ( +
+
{l.letter}
+
+ + + {Array.from({ length: Number(l.count) }).map(() => ( +
+ ))} + + +
+
+ )) + } + diff --git a/src/utils/releaseDate.ts b/src/utils/releaseDate.ts new file mode 100644 index 0000000..e134eb6 --- /dev/null +++ b/src/utils/releaseDate.ts @@ -0,0 +1,6 @@ +const locale = + navigator && navigator.languages && navigator.languages.length ? navigator.languages[0] : navigator.language + +const releaseDate = (date: Date) => new Intl.DateTimeFormat(locale, { dateStyle: 'medium' }).format(date) + +export default releaseDate