« get me outta code hell

content: generateGroupInfoPage: wiki-color close artist links - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/content/dependencies/generateGroupInfoPage.js
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2024-11-16 12:18:50 -0400
committer(quasar) nebula <qznebula@protonmail.com>2024-11-17 13:39:59 -0400
commitaa800e588c498c2a454fa8d996bb679b5cfe5bb7 (patch)
tree1440d3e7db01f49a5d5b9dc53ff0cccc459e2a56 /src/content/dependencies/generateGroupInfoPage.js
parent0337711ed78c05418ba793b71fde082d96b1cb5b (diff)
content: generateGroupInfoPage: wiki-color close artist links
Diffstat (limited to 'src/content/dependencies/generateGroupInfoPage.js')
-rw-r--r--src/content/dependencies/generateGroupInfoPage.js38
1 files changed, 27 insertions, 11 deletions
diff --git a/src/content/dependencies/generateGroupInfoPage.js b/src/content/dependencies/generateGroupInfoPage.js
index 31f43208..deddfd68 100644
--- a/src/content/dependencies/generateGroupInfoPage.js
+++ b/src/content/dependencies/generateGroupInfoPage.js
@@ -1,5 +1,6 @@
 export default {
   contentDependencies: [
+    'generateColorStyleAttribute',
     'generateGroupInfoPageAlbumsSection',
     'generateGroupNavLinks',
     'generateGroupSecondaryNav',
@@ -15,6 +16,9 @@ export default {
   sprawl: ({wikiInfo}) => ({
     enableGroupUI:
       wikiInfo.enableGroupUI,
+
+    wikiColor:
+      wikiInfo.color,
   }),
 
   relations: (relation, sprawl, group) => ({
@@ -34,6 +38,9 @@ export default {
         ? relation('generateGroupSidebar', group)
         : null),
 
+    wikiColorAttribute:
+      relation('generateColorStyleAttribute', sprawl.wikiColor),
+
     closeArtistLinks:
       group.closelyLinkedArtists
         .map(artist => relation('linkArtist', artist)),
@@ -68,17 +75,26 @@ export default {
           html.tag('p',
             {[html.onlyIfContent]: true},
 
-            language.encapsulate(pageCapsule, 'closelyLinkedArtists', capsule =>
-              (relations.closeArtistLinks.length === 0
-                ? html.blank()
-             : relations.closeArtistLinks.length === 1
-                ? language.$(capsule, 'one', {
-                    artist: relations.closeArtistLinks,
-                  })
-                : language.$(capsule, 'multiple', {
-                    artists:
-                      language.formatUnitList(relations.closeArtistLinks),
-                  })))),
+            language.encapsulate(pageCapsule, 'closelyLinkedArtists', capsule => {
+              let option;
+              [capsule, option] =
+                (relations.closeArtistLinks.length === 0
+                  ? [null, null]
+               : relations.closeArtistLinks.length === 1
+                  ? [language.encapsulate(capsule, 'one'), 'artist']
+                  : [language.encapsulate(capsule, 'multiple'), 'artists']);
+
+              if (!capsule) return html.blank();
+
+              return language.$(capsule, {
+                [option]:
+                  language.formatUnitList(
+                    relations.closeArtistLinks
+                      .map(link => link.slots({
+                        attributes: [relations.wikiColorAttribute],
+                      }))),
+              });
+            })),
 
           html.tag('p',
             {[html.onlyIfContent]: true},