« get me outta code hell

content: gGIPAlbumsListItem: group-disconnected albums - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/content/dependencies/generateGroupInfoPageAlbumsListItem.js
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2024-11-02 23:08:33 -0300
committer(quasar) nebula <qznebula@protonmail.com>2024-11-02 23:08:33 -0300
commit4793c04918a62189c040c7aade490f7a9a8b8b36 (patch)
tree6456e00f6ce79cedc3280a3ecba5a9a4dad2eef4 /src/content/dependencies/generateGroupInfoPageAlbumsListItem.js
parent4ce3e7afbc99cc4a6efe9b63a4b53cde6384cde7 (diff)
content: gGIPAlbumsListItem: group-disconnected albums preview
Diffstat (limited to 'src/content/dependencies/generateGroupInfoPageAlbumsListItem.js')
-rw-r--r--src/content/dependencies/generateGroupInfoPageAlbumsListItem.js29
1 files changed, 26 insertions, 3 deletions
diff --git a/src/content/dependencies/generateGroupInfoPageAlbumsListItem.js b/src/content/dependencies/generateGroupInfoPageAlbumsListItem.js
index f0e1e39c..99e7e8ff 100644
--- a/src/content/dependencies/generateGroupInfoPageAlbumsListItem.js
+++ b/src/content/dependencies/generateGroupInfoPageAlbumsListItem.js
@@ -24,7 +24,7 @@ export default {
     return {otherGroups};
   },
 
-  relations: (relation, query, album) => ({
+  relations: (relation, query, album, _group) => ({
     colorStyle:
       relation('generateColorStyleAttribute', album.color),
 
@@ -44,13 +44,21 @@ export default {
         .map(group => relation('linkGroup', group)),
   }),
 
+  data: (_query, album, group) => ({
+    groupName:
+      group.name,
+
+    notFromThisGroup:
+      !group.albums.includes(album),
+  }),
+
   slots: {
     accentMode: {
       validate: v => v.is('groups', 'artists'),
     },
   },
 
-  generate: (relations, slots, {html, language}) =>
+  generate: (data, relations, slots, {html, language}) =>
     html.tag('li',
       relations.colorStyle,
 
@@ -74,7 +82,22 @@ export default {
 
           const otherGroupCapsule = language.encapsulate(itemCapsule, 'withOtherGroup');
 
-          if (slots.accentMode === 'groups' && !empty(relations.otherGroupLinks)) {
+          if (
+            (slots.accentMode === 'groups' ||
+             slots.accentMode === null) &&
+            data.notFromThisGroup
+          ) {
+            workingCapsule += '.withOtherGroup';
+            workingOptions.otherGroupAccent =
+              html.tag('span', {class: 'other-group-accent'},
+                language.$(otherGroupCapsule, 'notFromThisGroup', {
+                  group:
+                    data.groupName,
+                }));
+          } else if (
+            slots.accentMode === 'groups' &&
+            !empty(relations.otherGroupLinks)
+          ) {
             workingCapsule += '.withOtherGroup';
             workingOptions.otherGroupAccent =
               html.tag('span', {class: 'other-group-accent'},