diff options
author | (quasar) nebula <qznebula@protonmail.com> | 2023-02-05 08:46:06 -0400 |
---|---|---|
committer | (quasar) nebula <qznebula@protonmail.com> | 2023-02-05 09:15:48 -0400 |
commit | b8daaca57747812d9a9188a3782eb818e09615ad (patch) | |
tree | 606eb8acee16dab4263e3a90ba3d3ad1400ed617 /src | |
parent | 63d30446d260c1e732bd53dd11414ca087913853 (diff) |
support trackless albums
This also keeps the wiki from exploding when all tracks in a given album are errored (so its track list is empty).
Diffstat (limited to 'src')
-rw-r--r-- | src/page/album.js | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/page/album.js b/src/page/album.js index 1fc74520..80397065 100644 --- a/src/page/album.js +++ b/src/page/album.js @@ -53,7 +53,7 @@ export function write(album, {wikiData}) { const displayTrackGroups = album.trackGroups && (album.trackGroups.length > 1 || - !album.trackGroups[0].isDefaultTrackGroup); + !album.trackGroups[0]?.isDefaultTrackGroup); const listTag = getAlbumListTag(album); @@ -301,6 +301,7 @@ export function write(album, {wikiData}) { })), displayTrackGroups && + !empty(album.trackGroups) && html.tag('dl', {class: 'album-group-list'}, album.trackGroups.flatMap(({ @@ -323,6 +324,7 @@ export function write(album, {wikiData}) { ])), !displayTrackGroups && + !empty(album.tracks) && html.tag(listTag, album.tracks.map(trackToListItem)), @@ -759,6 +761,10 @@ export function generateAlbumNavLinks(album, currentTrack, { randomLink, ].filter(Boolean); + if (empty(allLinks)) { + return ''; + } + return `(${language.formatUnitList(allLinks)})`; } |