« get me outta code hell

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:
Diffstat (limited to 'src/content/dependencies')
-rw-r--r--src/content/dependencies/generateTrackChronologyLinks.js16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/content/dependencies/generateTrackChronologyLinks.js b/src/content/dependencies/generateTrackChronologyLinks.js
index 2849d020..5f6b0771 100644
--- a/src/content/dependencies/generateTrackChronologyLinks.js
+++ b/src/content/dependencies/generateTrackChronologyLinks.js
@@ -1,5 +1,5 @@
 import {sortAlbumsTracksChronologically} from '#sort';
-import {accumulateSum} from '#sugar';
+import {accumulateSum, stitchArrays} from '#sugar';
 
 import getChronologyRelations from '../util/getChronologyRelations.js';
 
@@ -107,7 +107,7 @@ export default {
   },
 
   generate(relations) {
-    function slotScopedRelations(content) {
+    function slotScopedRelations({content, artworkHeadingString}) {
       return content.chronologyLinks.slots({
         showOnly: true,
         allowCollapsing: false,
@@ -118,7 +118,7 @@ export default {
             contributions: content.artistChronologyContributions,
           },
           {
-            headingString: 'misc.chronology.heading.coverArt',
+            headingString: `misc.chronology.heading.${artworkHeadingString}`,
             contributions: content.coverArtistChronologyContributions,
           },
         ],
@@ -135,6 +135,11 @@ export default {
       relations.album,
     ];
 
+    const artworkHeadingStrings = [
+      'coverArt',
+      'trackArt',
+    ];
+
     const totalContributionCount =
       Math.max(...
         contents.map(content =>
@@ -150,7 +155,10 @@ export default {
         totalContributionCount <= 5,
 
       contents:
-        contents.map(content => slotScopedRelations(content))
+        stitchArrays({
+          content: contents,
+          artworkHeadingString: artworkHeadingStrings,
+        }).map(slotScopedRelations),
     });
 
     return relations.scopeSwitcher;