diff options
author | (quasar) nebula <qznebula@protonmail.com> | 2022-12-21 21:36:58 -0400 |
---|---|---|
committer | (quasar) nebula <qznebula@protonmail.com> | 2022-12-21 21:37:13 -0400 |
commit | e6f233025c0e511bb472bb75540d50381b58db48 (patch) | |
tree | 72dccb2167d9913d52ce600cbd66b2a360765e0a /src/page | |
parent | 485afee14f88d5ff30eda2e2185531d4b1695c30 (diff) |
gallery conditions for tracks without unique art
Diffstat (limited to 'src/page')
-rw-r--r-- | src/page/album.js | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/src/page/album.js b/src/page/album.js index fb738db8..28c09907 100644 --- a/src/page/album.js +++ b/src/page/album.js @@ -416,13 +416,22 @@ export function write(album, {wikiData}) { html.tag('div', {class: 'grid-listing'}, getGridHTML({ - srcFn: t => t.album ? getTrackCover(t) : getAlbumCover(t), linkFn: (t, opts) => t.album ? link.track(t, opts) : link.album(t, opts), noSrcTextFn: t => language.$('misc.albumGalleryGrid.noCoverArt', { name: t.name, }), + srcFn(t) { + if (!t.album) { + return getAlbumCover(t); + } else if (t.hasUniqueCoverArt) { + return getTrackCover(t); + } else { + return null; + } + }, + entries: [ // {item: album}, ...album.tracks.map(track => ({item: track})), @@ -641,12 +650,12 @@ export function generateAlbumSecondaryNav(album, currentTrack, { }; } -function checkGalleryPage(_album) { - return true; +function checkGalleryPage(album) { + return album.tracks.some(t => t.hasUniqueCoverArt); } function checkCommentaryPage(album) { - return !empty([album, ...album.tracks].filter((x) => x.commentary)); + return !!album.commentary || album.tracks.some(t => t.commentary); } export function generateAlbumNavLinks(album, currentTrack, { |