« get me outta code hell

support albums and tracks without release dates - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/page/album.js
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2022-05-05 19:36:59 -0300
committer(quasar) nebula <qznebula@protonmail.com>2022-05-05 19:36:59 -0300
commit27d366fd2de98d816ef0698a1a6d5b4d59b388ca (patch)
tree9f87d11391153ec7acd4f1c88eb46f39517e488f /src/page/album.js
parent9525ec4e143d17329c303e4ad09242a6dab9a9b9 (diff)
support albums and tracks without release dates
Diffstat (limited to 'src/page/album.js')
-rw-r--r--src/page/album.js9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/page/album.js b/src/page/album.js
index eac0a9f..66d4bfa 100644
--- a/src/page/album.js
+++ b/src/page/album.js
@@ -168,7 +168,7 @@ export function write(album, {wikiData}) {
                                         showIcons: true
                                     })
                                 }),
-                                strings('releaseInfo.released', {
+                                album.date && strings('releaseInfo.released', {
                                     date: strings.count.date(album.date)
                                 }),
                                 (album.coverArtDate &&
@@ -328,9 +328,10 @@ export function generateAlbumSidebar(album, currentTrack, {
     const { groups } = album;
 
     const groupParts = groups.map(group => {
-        const index = group.albums.indexOf(album);
-        const next = group.albums[index + 1];
-        const previous = group.albums[index - 1];
+        const albums = group.albums.filter(album => album.date);
+        const index = albums.indexOf(album);
+        const next = index >= 0 && albums[index + 1];
+        const previous = index > 0 && albums[index - 1];
         return {group, next, previous};
     }).map(({group, next, previous}) => fixWS`
         <h1>${