From 7dcd39f106adb6971f3d591d086485ed7d0ca879 Mon Sep 17 00:00:00 2001 From: Jorge Vargas Date: Sun, 27 Apr 2025 11:32:16 -0600 Subject: [PATCH 1/6] Implement /publisher/list --- src/components/letterList/PublisherList.astro | 21 +++++++++++ src/pages/publisher/list/index.astro | 35 +++++++++++++++++++ 2 files changed, 56 insertions(+) create mode 100644 src/components/letterList/PublisherList.astro create mode 100644 src/pages/publisher/list/index.astro diff --git a/src/components/letterList/PublisherList.astro b/src/components/letterList/PublisherList.astro new file mode 100644 index 0000000..92e83f9 --- /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/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(() => ( +
+ ))} + + +
+
+ )) + } + From 8fd7f7decec5c189be4f1f50e61d5f26c74ac8a2 Mon Sep 17 00:00:00 2001 From: Jorge Vargas Date: Sun, 27 Apr 2025 11:42:27 -0600 Subject: [PATCH 2/6] Implement /platform/list --- astro.config.mjs | 1 - src/components/Header.astro | 2 +- src/components/letterList/PlatformList.astro | 21 ++++++++++++ src/pages/platform/list/index.astro | 36 ++++++++++++++++++++ 4 files changed, 58 insertions(+), 2 deletions(-) create mode 100644 src/components/letterList/PlatformList.astro create mode 100644 src/pages/platform/list/index.astro diff --git a/astro.config.mjs b/astro.config.mjs index 966c2b1..f9f5b3d 100644 --- a/astro.config.mjs +++ b/astro.config.mjs @@ -51,7 +51,6 @@ export default defineConfig({ '/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' }, 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/letterList/PlatformList.astro b/src/components/letterList/PlatformList.astro new file mode 100644 index 0000000..ff89a2b --- /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/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(() => ( +
+ ))} + + +
+
+ )) + } + From 3b1cd9089532bad79b213d83b531c7dde9708393 Mon Sep 17 00:00:00 2001 From: Jorge Vargas Date: Sun, 27 Apr 2025 11:50:25 -0600 Subject: [PATCH 3/6] Implement /studio/list --- astro.config.mjs | 1 - src/components/letterList/StudioList.astro | 21 +++++++++++++ src/pages/studio/list/index.astro | 35 ++++++++++++++++++++++ 3 files changed, 56 insertions(+), 1 deletion(-) create mode 100644 src/components/letterList/StudioList.astro create mode 100644 src/pages/studio/list/index.astro diff --git a/astro.config.mjs b/astro.config.mjs index f9f5b3d..d08dee0 100644 --- a/astro.config.mjs +++ b/astro.config.mjs @@ -56,7 +56,6 @@ export default defineConfig({ '/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/letterList/StudioList.astro b/src/components/letterList/StudioList.astro new file mode 100644 index 0000000..49e6797 --- /dev/null +++ b/src/components/letterList/StudioList.astro @@ -0,0 +1,21 @@ +--- +import prismaClient from 'utils/prisma-client' + +interface Props { + letter: string +} + +const { letter } = Astro.props +const games = await prismaClient.studio.findMany({ + where: { name: { startsWith: letter } }, + select: { slug: true, name: true } +}) +--- + +{ + games.map((a) => ( + + {a.name} + + )) +} 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(() => ( +
+ ))} + + +
+
+ )) + } + From 676324fcd8facb06764bafe8b0fe35239827704c Mon Sep 17 00:00:00 2001 From: Jorge Vargas Date: Sun, 27 Apr 2025 11:50:28 -0600 Subject: [PATCH 4/6] Fix links --- src/components/letterList/PlatformList.astro | 2 +- src/components/letterList/PublisherList.astro | 2 +- src/components/letterList/SeriesList.astro | 2 +- src/components/letterList/SeriesListCover.astro | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/components/letterList/PlatformList.astro b/src/components/letterList/PlatformList.astro index ff89a2b..4721932 100644 --- a/src/components/letterList/PlatformList.astro +++ b/src/components/letterList/PlatformList.astro @@ -14,7 +14,7 @@ const games = await prismaClient.platform.findMany({ { games.map((a) => ( - + {a.name} )) diff --git a/src/components/letterList/PublisherList.astro b/src/components/letterList/PublisherList.astro index 92e83f9..87875d8 100644 --- a/src/components/letterList/PublisherList.astro +++ b/src/components/letterList/PublisherList.astro @@ -14,7 +14,7 @@ const games = await prismaClient.publisher.findMany({ { 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} Date: Sun, 27 Apr 2025 22:23:48 -0600 Subject: [PATCH 5/6] Implement animation pages --- astro.config.mjs | 1 - src/components/albumPage/releaseDate.tsx | 10 -- src/pages/album/[id].astro | 3 +- src/pages/anim/[id].astro | 126 +++++++++++++++++++++++ src/utils/releaseDate.ts | 6 ++ 5 files changed, 134 insertions(+), 12 deletions(-) delete mode 100644 src/components/albumPage/releaseDate.tsx create mode 100644 src/pages/anim/[id].astro create mode 100644 src/utils/releaseDate.ts diff --git a/astro.config.mjs b/astro.config.mjs index d08dee0..9e4df65 100644 --- a/astro.config.mjs +++ b/astro.config.mjs @@ -49,7 +49,6 @@ export default defineConfig({ adapter: node({ mode: 'standalone' }), redirects: { '/en/[...params]': '/[...params]', - '/anim/[id]': { status: 307, destination: '/maintenance' }, '/game/[slug]': { status: 307, destination: '/maintenance' }, '/platform/[id]': { status: 307, destination: '/maintenance' }, '/profile': { status: 307, destination: '/maintenance' }, 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/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' }] + }} +/> + + +
+ + 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 From 427f271375a43b0764da0c372e9a72aac2a797e0 Mon Sep 17 00:00:00 2001 From: Jorge Vargas Date: Mon, 28 Apr 2025 11:55:15 -0600 Subject: [PATCH 6/6] Implement games page --- astro.config.mjs | 1 - src/pages/game/[slug].astro | 146 ++++++++++++++++++++++++++++++++++++ 2 files changed, 146 insertions(+), 1 deletion(-) create mode 100644 src/pages/game/[slug].astro 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) => ( + + )) + } +
+
+
+