« get me outta code hell

data, content: showAlbumArtists: all/differing/none - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/content
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2024-12-29 21:00:55 -0400
committer(quasar) nebula <qznebula@protonmail.com>2024-12-29 21:01:14 -0400
commitf9e08473fbc0a2f088be3ade780b922ea1b3f22c (patch)
tree2a3b9b7c90c55cb09877788d28c934010a510ec3 /src/content
parente5eb30bd10728fd730086c41332305593731636c (diff)
data, content: showAlbumArtists: all/differing/none
This breaks the build. Oop
Diffstat (limited to 'src/content')
-rw-r--r--src/content/dependencies/generateGroupInfoPageAlbumsListBySeries.js40
1 files changed, 28 insertions, 12 deletions
diff --git a/src/content/dependencies/generateGroupInfoPageAlbumsListBySeries.js b/src/content/dependencies/generateGroupInfoPageAlbumsListBySeries.js
index 463522ea..bcd5d288 100644
--- a/src/content/dependencies/generateGroupInfoPageAlbumsListBySeries.js
+++ b/src/content/dependencies/generateGroupInfoPageAlbumsListBySeries.js
@@ -8,7 +8,13 @@ export default {
 
   extraDependencies: ['html', 'language'],
 
-  relations: (relation, group) => ({
+  query: (group) => ({
+    closelyLinkedArtists:
+      group.closelyLinkedArtists
+        .map(({artist}) => artist),
+  }),
+
+  relations: (relation, _query, group) => ({
     seriesHeadings:
       group.serieses
         .map(() => relation('generateContentHeading')),
@@ -22,14 +28,21 @@ export default {
               group))),
   }),
 
-  data: (group) => ({
+  data: (query, group) => ({
     seriesNames:
       group.serieses
         .map(series => series.name),
 
-    seriesShowAlbumArtists:
-      group.serieses
-        .map(series => series.showAlbumArtists),
+    seriesItemsShowArtists:
+      group.serieses.map(series =>
+        (series.showAlbumArtists === 'all'
+          ? new Array(series.albums.length).fill(true)
+       : series.showAlbumArtists === 'differing'
+          ? series.albums.map(album =>
+              album.artistContribs
+                .map(contrib => contrib.artist)
+                .some(artist => !query.closelyLinkedArtists.includes(artist)))
+          : new Array(series.albums.length).fill(false))),
   }),
 
   generate: (data, relations, {html, language}) =>
@@ -42,12 +55,12 @@ export default {
 
         stitchArrays({
           name: data.seriesNames,
-          showAlbumArtists: data.seriesShowAlbumArtists,
+          itemsShowArtists: data.seriesItemsShowArtists,
           heading: relations.seriesHeadings,
           items: relations.seriesItems,
         }).map(({
             name,
-            showAlbumArtists,
+            itemsShowArtists,
             heading,
             items,
           }) =>
@@ -62,10 +75,13 @@ export default {
 
               html.tag('dd',
                 html.tag('ul',
-                  items.map(item =>
-                    item.slots({
-                      accentMode:
-                        (showAlbumArtists ? 'artists' : null),
-                    })))),
+                  stitchArrays({
+                    item: items,
+                    showArtists: itemsShowArtists,
+                  }).map(({item, showArtists}) =>
+                      item.slots({
+                        accentMode:
+                          (showArtists ? 'artists' : null),
+                      })))),
             ])))),
 };