« get me outta code hell

content: generateAlbumCommentaryPage: track listening links - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2023-11-07 20:33:37 -0400
committer(quasar) nebula <qznebula@protonmail.com>2023-11-16 14:32:32 -0400
commita328c845c0e8c89a9ca39a33c18016a1a88e023b (patch)
tree87fa8c0ad1f80262e5059797040b35d7102164f0
parent0936a1d377f45dbfcfe28ff0fd735b6faeb66cbf (diff)
content: generateAlbumCommentaryPage: track listening links
-rw-r--r--src/content/dependencies/generateAlbumCommentaryPage.js32
-rw-r--r--src/strings-default.yaml4
2 files changed, 33 insertions, 3 deletions
diff --git a/src/content/dependencies/generateAlbumCommentaryPage.js b/src/content/dependencies/generateAlbumCommentaryPage.js
index 001003ae..3e97c379 100644
--- a/src/content/dependencies/generateAlbumCommentaryPage.js
+++ b/src/content/dependencies/generateAlbumCommentaryPage.js
@@ -11,6 +11,7 @@ export default {
     'generateTrackCoverArtwork',
     'generatePageLayout',
     'linkAlbum',
+    'linkExternal',
     'linkTrack',
   ],
 
@@ -54,6 +55,11 @@ export default {
       tracksWithCommentary
         .map(track => relation('linkTrack', track));
 
+    relations.trackCommentaryListeningLinks =
+      tracksWithCommentary
+        .map(track =>
+          track.urls.map(url => relation('linkExternal', url)));
+
     relations.trackCommentaryCovers =
       tracksWithCommentary
         .map(track =>
@@ -156,15 +162,37 @@ export default {
           stitchArrays({
             heading: relations.trackCommentaryHeadings,
             link: relations.trackCommentaryLinks,
+            listeningLinks: relations.trackCommentaryListeningLinks,
             directory: data.trackCommentaryDirectories,
             cover: relations.trackCommentaryCovers,
             entries: relations.trackCommentaryEntries,
             color: data.trackCommentaryColors,
-          }).map(({heading, link, directory, cover, entries, color}) => [
+          }).map(({
+              heading,
+              link,
+              listeningLinks,
+              directory,
+              cover,
+              entries,
+              color,
+            }) => [
               heading.slots({
                 tag: 'h3',
                 id: directory,
-                title: link,
+                color,
+
+                title:
+                  language.$('albumCommentaryPage.entry.title.trackCommentary', {
+                    track: link,
+                  }),
+
+                accent:
+                  language.$('albumCommentaryPage.entry.title.trackCommentary.accent', {
+                    listeningLinks:
+                      language.formatUnitList(
+                        listeningLinks.map(link =>
+                          link.slot('tab', 'separate'))),
+                  }),
               }),
 
               cover?.slots({mode: 'commentary'}),
diff --git a/src/strings-default.yaml b/src/strings-default.yaml
index 5a3d172f..30261e80 100644
--- a/src/strings-default.yaml
+++ b/src/strings-default.yaml
@@ -754,7 +754,9 @@ albumCommentaryPage:
   entry:
     title:
       albumCommentary: "Album commentary"
-      trackCommentary: "{TRACK}"
+      trackCommentary:
+        _: "{TRACK}"
+        accent: "({LISTENING_LINKS})"
 
 #
 # artistInfoPage: