From c8db1c57b48b9622017e44fa512d48dc7a7f956c Mon Sep 17 00:00:00 2001 From: Jorge Vargas Date: Thu, 20 Feb 2025 21:29:17 -0600 Subject: [PATCH] Fix album page response --- src/pages/album/[id].astro | 71 +++++++++++++++++++------------------- 1 file changed, 36 insertions(+), 35 deletions(-) diff --git a/src/pages/album/[id].astro b/src/pages/album/[id].astro index 946a198..1bfc114 100644 --- a/src/pages/album/[id].astro +++ b/src/pages/album/[id].astro @@ -34,7 +34,6 @@ const album = await prismaClient.albums.findUnique({ if (!album) { Astro.response.status = 404 Astro.response.statusText = 'Not found' - return } const { currentLocale } = Astro --- @@ -53,8 +52,8 @@ const { currentLocale } = Astro
{`${album.title}
-
{album.title}
- {album.subTitle ?
{album.subTitle}
: null} +
{album?.title}
+ {album?.subTitle ?
{album?.subTitle}
: null} { - album.releaseDate ? ( + album?.releaseDate ? ( - + ) : null } { - album.artistList.length > 0 && ( + (album?.artistList.length ?? 0) > 0 && ( - + ) } @@ -91,8 +92,8 @@ const { currentLocale } = Astro { - album.label && ( + album?.label && ( ) } { - album.platformList.length > 0 && ( + (album?.platformList.length ?? 0) > 0 && ( @@ -135,16 +136,16 @@ const { currentLocale } = Astro ) } { - album.gameList.length > 0 && ( + (album?.gameList.length ?? 0) > 0 && ( @@ -152,16 +153,16 @@ const { currentLocale } = Astro ) } { - album.animList.length > 0 && ( + (album?.animList.length ?? 0) > 0 && ( @@ -172,12 +173,12 @@ const { currentLocale } = Astro
{m.releaseDate()}{new Intl.DateTimeFormat(currentLocale, { dateStyle: 'medium' }).format(album.releaseDate)} + {new Intl.DateTimeFormat(currentLocale, { dateStyle: 'medium' }).format(album?.releaseDate)} +
{m.artists()}{album.artistList.map(({ artist }) => artist.name).join(', ')}{album?.artistList.map(({ artist }) => artist.name).join(', ')}
{ [ - album.categoryList.map(({ categoryName }) => (m as any)[`${categoryName}Osts`]()).join(' & '), - album.classificationList.map(({ classificationName }) => classificationName).join(', ') + album?.categoryList.map(({ categoryName }) => (m as any)[`${categoryName}Osts`]()).join(' & '), + album?.classificationList.map(({ classificationName }) => classificationName).join(', ') ] .filter((f) => f !== '') .join(' - ') @@ -100,23 +101,23 @@ const { currentLocale } = Astro
{m.publishedBy()} - - {album.label} + + {album?.label}
{m.platforms()} - {album.platformList.map(({ platform }, i) => ( + {album?.platformList.map(({ platform }, i) => ( {id === '29' ? ( @@ -127,7 +128,7 @@ const { currentLocale } = Astro {platform.name} )} - {i !== album.platformList.length - 1 && ', '} + {i !== album?.platformList.length - 1 && ', '} ))}
{m.games()} - {album.gameList.map(({ game }, i) => ( + {album?.gameList.map(({ game }, i) => ( {game.name} - {i !== album.gameList.length - 1 && ', '} + {i !== album?.gameList.length - 1 && ', '} ))}
{m.animations()} - {album.animList.map(({ animation }, i) => ( + {album?.animList.map(({ animation }, i) => ( {animation.title} - {i !== album.animList.length - 1 && ', '} + {i !== album?.animList.length - 1 && ', '} ))}
{m.avgRating()} - +
- +
@@ -189,28 +190,28 @@ const { currentLocale } = Astro
- +
{ - album.vgmdb && ( + album?.vgmdb && (
{m.checkVGMDB()}: - + {'VGMdb'}
) } { - album.stores.length > 0 && ( + (album?.stores.length ?? 0) > 0 && (