« get me outta code hell

content, css: gGIPAlbumsListItem: mode-selected album artists - 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-10-18 08:55:15 -0300
committer(quasar) nebula <qznebula@protonmail.com>2024-11-02 22:12:50 -0300
commit218adc112f343c8562ba081f0def7b3788b36781 (patch)
tree8838bf3be997dad62b8ac62abca04a29dcc5a367 /src/content
parent8e5c0d5f858716ce6029e47afdde9ded79ed8e32 (diff)
content, css: gGIPAlbumsListItem: mode-selected album artists
Diffstat (limited to 'src/content')
-rw-r--r--src/content/dependencies/generateGroupInfoPageAlbumsListByDate.js4
-rw-r--r--src/content/dependencies/generateGroupInfoPageAlbumsListBySeries.js18
-rw-r--r--src/content/dependencies/generateGroupInfoPageAlbumsListItem.js44
3 files changed, 59 insertions, 7 deletions
diff --git a/src/content/dependencies/generateGroupInfoPageAlbumsListByDate.js b/src/content/dependencies/generateGroupInfoPageAlbumsListByDate.js
index 079cb56c..df42598d 100644
--- a/src/content/dependencies/generateGroupInfoPageAlbumsListByDate.js
+++ b/src/content/dependencies/generateGroupInfoPageAlbumsListByDate.js
@@ -41,5 +41,7 @@ export default {
 
       {[html.onlyIfContent]: true},
 
-      relations.items),
+      relations.items
+        .map(item =>
+          item.slot('accentMode', 'groups'))),
 };
diff --git a/src/content/dependencies/generateGroupInfoPageAlbumsListBySeries.js b/src/content/dependencies/generateGroupInfoPageAlbumsListBySeries.js
index 2e439897..463522ea 100644
--- a/src/content/dependencies/generateGroupInfoPageAlbumsListBySeries.js
+++ b/src/content/dependencies/generateGroupInfoPageAlbumsListBySeries.js
@@ -26,6 +26,10 @@ export default {
     seriesNames:
       group.serieses
         .map(series => series.name),
+
+    seriesShowAlbumArtists:
+      group.serieses
+        .map(series => series.showAlbumArtists),
   }),
 
   generate: (data, relations, {html, language}) =>
@@ -38,9 +42,15 @@ export default {
 
         stitchArrays({
           name: data.seriesNames,
+          showAlbumArtists: data.seriesShowAlbumArtists,
           heading: relations.seriesHeadings,
           items: relations.seriesItems,
-        }).map(({heading, name, items}) =>
+        }).map(({
+            name,
+            showAlbumArtists,
+            heading,
+            items,
+          }) =>
             html.tags([
               heading.slots({
                 tag: 'dt',
@@ -52,6 +62,10 @@ export default {
 
               html.tag('dd',
                 html.tag('ul',
-                  items)),
+                  items.map(item =>
+                    item.slots({
+                      accentMode:
+                        (showAlbumArtists ? 'artists' : null),
+                    })))),
             ])))),
 };
diff --git a/src/content/dependencies/generateGroupInfoPageAlbumsListItem.js b/src/content/dependencies/generateGroupInfoPageAlbumsListItem.js
index faa944ac..f0e1e39c 100644
--- a/src/content/dependencies/generateGroupInfoPageAlbumsListItem.js
+++ b/src/content/dependencies/generateGroupInfoPageAlbumsListItem.js
@@ -3,6 +3,7 @@ import {empty} from '#sugar';
 export default {
   contentDependencies: [
     'generateAbsoluteDatetimestamp',
+    'generateArtistCredit',
     'generateColorStyleAttribute',
     'linkAlbum',
     'linkGroup',
@@ -35,12 +36,21 @@ export default {
         ? relation('generateAbsoluteDatetimestamp', album.date)
         : null),
 
+    artistCredit:
+      relation('generateArtistCredit', album.artistContribs, []),
+
     otherGroupLinks:
       query.otherGroups
         .map(group => relation('linkGroup', group)),
   }),
 
-  generate: (relations, {html, language}) =>
+  slots: {
+    accentMode: {
+      validate: v => v.is('groups', 'artists'),
+    },
+  },
+
+  generate: (relations, slots, {html, language}) =>
     html.tag('li',
       relations.colorStyle,
 
@@ -51,20 +61,24 @@ export default {
           workingOptions.album =
             relations.albumLink.slot('color', false);
 
+          const yearCapsule = language.encapsulate(itemCapsule, 'withYear');
+
           if (relations.datetimestamp) {
             workingCapsule += '.withYear';
             workingOptions.yearAccent =
-              language.$(itemCapsule, 'yearAccent', {
+              language.$(yearCapsule, 'accent', {
                 year:
                   relations.datetimestamp.slots({style: 'year', tooltip: true}),
               });
           }
 
-          if (!empty(relations.otherGroupLinks)) {
+          const otherGroupCapsule = language.encapsulate(itemCapsule, 'withOtherGroup');
+
+          if (slots.accentMode === 'groups' && !empty(relations.otherGroupLinks)) {
             workingCapsule += '.withOtherGroup';
             workingOptions.otherGroupAccent =
               html.tag('span', {class: 'other-group-accent'},
-                language.$(itemCapsule, 'otherGroupAccent', {
+                language.$(otherGroupCapsule, 'accent', {
                   groups:
                     language.formatConjunctionList(
                       relations.otherGroupLinks.map(groupLink =>
@@ -72,6 +86,28 @@ export default {
                 }));
           }
 
+          const artistCapsule = language.encapsulate(itemCapsule, 'withArtists');
+          const {artistCredit} = relations;
+
+          artistCredit.setSlots({
+            normalStringKey:
+              artistCapsule + '.by',
+
+            featuringStringKey:
+              artistCapsule + '.featuring',
+
+            normalFeaturingStringKey:
+              artistCapsule + '.by.featuring',
+          });
+
+          if (slots.accentMode === 'artists' && !html.isBlank(artistCredit)) {
+            workingCapsule += '.withArtists';
+            workingOptions.by =
+              html.tag('span', {class: 'by'},
+                html.metatag('chunkwrap', {split: ','},
+                  html.resolve(artistCredit)));
+          }
+
           return language.$(workingCapsule, workingOptions);
         }))),
 };