« get me outta code hell

generateAlbumGalleryPage: incl. cover artists in grid info - 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-06-23 20:57:01 -0300
committer(quasar) nebula <qznebula@protonmail.com>2023-06-23 20:57:28 -0300
commit35ecbf36481393bc833d95aaf645602703f98be6 (patch)
tree5fb7ed0af88c1eb5a3a5f065d7f4d6d0593b38e2
parent1925d95bc715aa5b0cefb701a90defd57b401083 (diff)
generateAlbumGalleryPage: incl. cover artists in grid info
-rw-r--r--src/content/dependencies/generateAlbumGalleryPage.js13
-rw-r--r--src/strings-default.json1
2 files changed, 14 insertions, 0 deletions
diff --git a/src/content/dependencies/generateAlbumGalleryPage.js b/src/content/dependencies/generateAlbumGalleryPage.js
index 71cd477b..b39b4c80 100644
--- a/src/content/dependencies/generateAlbumGalleryPage.js
+++ b/src/content/dependencies/generateAlbumGalleryPage.js
@@ -60,6 +60,12 @@ export default {
     data.names =
       album.tracks.map(track => track.name);
 
+    data.coverArtists =
+      album.tracks.map(track =>
+        (track.hasUniqueCoverArt
+          ? track.coverArtistContribs.map(({who: artist}) => artist.name)
+          : null));
+
     data.paths =
       album.tracks.map(track =>
         (track.hasUniqueCoverArt
@@ -101,6 +107,13 @@ export default {
                       missingSourceContent:
                         language.$('misc.albumGalleryGrid.noCoverArt', {name}),
                     })),
+              info:
+                data.coverArtists.map(names =>
+                  (names === null
+                    ? null
+                    : language.$('misc.albumGrid.details.coverArtists', {
+                        artists: language.formatUnitList(names),
+                      }))),
             }),
         ],
 
diff --git a/src/strings-default.json b/src/strings-default.json
index 345f20ff..29ac8fb4 100644
--- a/src/strings-default.json
+++ b/src/strings-default.json
@@ -219,6 +219,7 @@
   "misc.contentWarnings": "cw: {WARNINGS}",
   "misc.contentWarnings.reveal": "click to show",
   "misc.albumGrid.details": "({TRACKS}, {TIME})",
+  "misc.albumGrid.details.coverArtists": "(Illust. {ARTISTS})",
   "misc.albumGrid.noCoverArt": "{ALBUM}",
   "misc.albumGalleryGrid.noCoverArt": "{NAME}",
   "misc.uiLanguage": "UI Language: {LANGUAGES}",