« get me outta code hell

hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/content/dependencies/generateAlbumSecondaryNavGroupPart.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/content/dependencies/generateAlbumSecondaryNavGroupPart.js')
-rw-r--r--src/content/dependencies/generateAlbumSecondaryNavGroupPart.js48
1 files changed, 15 insertions, 33 deletions
diff --git a/src/content/dependencies/generateAlbumSecondaryNavGroupPart.js b/src/content/dependencies/generateAlbumSecondaryNavGroupPart.js
index 81b0c75a..58a31630 100644
--- a/src/content/dependencies/generateAlbumSecondaryNavGroupPart.js
+++ b/src/content/dependencies/generateAlbumSecondaryNavGroupPart.js
@@ -4,12 +4,12 @@ import {atOffset} from '#sugar';
 export default {
   contentDependencies: [
     'generateColorStyleAttribute',
-    'generatePreviousNextLinks',
+    'generateSecondaryNavParentSiblingsPart',
     'linkAlbumDynamically',
     'linkGroup',
   ],
 
-  extraDependencies: ['html', 'language'],
+  extraDependencies: ['html'],
 
   query(group, album) {
     const query = {};
@@ -38,15 +38,15 @@ export default {
   },
 
   relations: (relation, query, group, _album) => ({
+    parentSiblingsPart:
+      relation('generateSecondaryNavParentSiblingsPart'),
+
     groupLink:
       relation('linkGroup', group),
 
     colorStyle:
       relation('generateColorStyleAttribute', group.color),
 
-    previousNextLinks:
-      relation('generatePreviousNextLinks'),
-
     previousAlbumLink:
       (query.previousAlbum
         ? relation('linkAlbumDynamically', query.previousAlbum)
@@ -65,34 +65,16 @@ export default {
     },
   },
 
-  generate: (relations, slots, {html, language}) =>
-    html.tag('span', {class: 'nav-link'},
-      relations.colorStyle
-        .slot('context', 'primary-only'),
-
-      language.encapsulate('albumSecondaryNav.group', workingCapsule => {
-        const workingOptions = {};
-
-        workingOptions.group =
-          relations.groupLink
-            .slot('color', false);
-
-        if (slots.mode === 'album') {
-          const {previousNextLinks} = relations;
-
-          previousNextLinks.setSlots({
-            previousLink: relations.previousAlbumLink,
-            nextLink: relations.nextAlbumLink,
-            id: false,
-          });
+  generate: (relations, slots) =>
+    relations.parentSiblingsPart.slots({
+      mode: slots.mode,
 
-          if (!html.isBlank(previousNextLinks)) {
-            workingCapsule += '.withPreviousNext';
-            workingOptions.previousNext =
-              language.formatUnitList(previousNextLinks.content);
-          }
-        }
+      colorStyle: relations.colorStyle,
+      mainLink: relations.groupLink,
+      previousLink: relations.previousAlbumLink,
+      nextLink: relations.nextAlbumLink,
 
-        return language.$(workingCapsule, workingOptions);
-      })),
+      stringsKey: 'albumSecondaryNav.group',
+      mainLinkOption: 'group',
+    }),
 };