diff options
author | (quasar) nebula <qznebula@protonmail.com> | 2023-04-04 15:48:39 -0300 |
---|---|---|
committer | (quasar) nebula <qznebula@protonmail.com> | 2023-04-04 15:48:39 -0300 |
commit | 86c31c72f81ccd59eba0f7e7867454176c660ccb (patch) | |
tree | 042832d8d750f139c10787ab45bf5b80eaae38e5 | |
parent | c514435102d95c3dec6321b57c465a5b8146288b (diff) |
content: generateAlbumTrackListItem: fixes & polish
-rw-r--r-- | src/content/dependencies/generateAlbumTrackListItem.js | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/src/content/dependencies/generateAlbumTrackListItem.js b/src/content/dependencies/generateAlbumTrackListItem.js index fb315cb1..dd41ba11 100644 --- a/src/content/dependencies/generateAlbumTrackListItem.js +++ b/src/content/dependencies/generateAlbumTrackListItem.js @@ -7,7 +7,7 @@ export default { ], extraDependencies: [ - 'getLinkThemeString', + 'getColors', 'html', 'language', ], @@ -27,7 +27,7 @@ export default { return relations; }, - data(track) { + data(track, album) { const data = {}; data.color = track.color; @@ -36,12 +36,14 @@ export default { data.showArtists = !compareArrays( track.artistContribs.map(c => c.who), - track.album.artistContribs.map(c => c.who), + album.artistContribs.map(c => c.who), {checkOrder: false}); + + return data; }, generate(data, relations, { - getLinkThemeString, + getColors, html, language, }) { @@ -50,8 +52,14 @@ export default { track: relations.trackLink, }; + let style; + if (data.color) { + const {primary} = getColors(data.color); + style = `--primary-color: ${primary}`; + } + return html.tag('li', - {style: getLinkThemeString(data.color)}, + {style}, (!data.showArtists ? language.$('trackList.item.withDuration', stringOpts) : language.$('trackList.item.withDuration.withArtists', { |