« get me outta code hell

content: generateAlbumTrackListItem: incl. color only if different from album - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/content/dependencies
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2023-06-24 18:23:11 -0300
committer(quasar) nebula <qznebula@protonmail.com>2023-06-24 18:23:11 -0300
commit971b9fb1d861682fa6f82c005244edd56f6a7377 (patch)
tree12e49e9b4d21b98b79a2fa70e5c71f857d148a6d /src/content/dependencies
parent5bcc678e133d1b94fce5d51b333daf6c117bf28c (diff)
content: generateAlbumTrackListItem: incl. color only if different from album
Diffstat (limited to 'src/content/dependencies')
-rw-r--r--src/content/dependencies/generateAlbumTrackListItem.js13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/content/dependencies/generateAlbumTrackListItem.js b/src/content/dependencies/generateAlbumTrackListItem.js
index 794c4201..15aecba0 100644
--- a/src/content/dependencies/generateAlbumTrackListItem.js
+++ b/src/content/dependencies/generateAlbumTrackListItem.js
@@ -24,9 +24,12 @@ export default {
   data(track, album) {
     const data = {};
 
-    data.color = track.color;
     data.duration = track.duration ?? 0;
 
+    if (track.color !== album.color) {
+      data.color = track.color;
+    }
+
     data.showArtists =
       !compareArrays(
         track.artistContribs.map(c => c.who),
@@ -47,8 +50,12 @@ export default {
     const parts = ['trackList.item.withDuration'];
     const options = {};
 
-    options.duration = language.formatDuration(data.duration);
-    options.track = relations.trackLink;
+    options.duration =
+      language.formatDuration(data.duration);
+
+    options.track =
+      relations.trackLink
+        .slot('color', false);
 
     if (data.showArtists) {
       parts.push('withArtists');