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' }] + }} +/> + + +
+
+
+
+
+ {`${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/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