« get me outta code hell

hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/content/dependencies/generateTrackChronologyLinks.js16
-rw-r--r--src/strings-default.yaml1
2 files changed, 13 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;
diff --git a/src/strings-default.yaml b/src/strings-default.yaml
index 0e63201e..7dcbf9c1 100644
--- a/src/strings-default.yaml
+++ b/src/strings-default.yaml
@@ -490,6 +490,7 @@ misc:
       coverArt: "{INDEX} cover art by {ARTIST}"
       flash: "{INDEX} flash/game by {ARTIST}"
       track: "{INDEX} track by {ARTIST}"
+      trackArt: "{INDEX} track art by {ARTIST}"
       onlyIndex: "Only"
 
   # external: