« get me outta code hell

content, css, test: generateAlbumSecondaryNav: new prev/next - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/content/dependencies/generateAlbumSecondaryNavSeriesPart.js
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2024-08-15 11:44:46 -0300
committer(quasar) nebula <qznebula@protonmail.com>2024-11-02 22:25:46 -0300
commitdf1d07633d344e278b4e5d10a2f1629ccb8ef7df (patch)
tree7f7d0311ed3f38f3742a9d1223a87b8375a3dc7a /src/content/dependencies/generateAlbumSecondaryNavSeriesPart.js
parente77262e34657164b5c194d2e639ff4ce627134a9 (diff)
content, css, test: generateAlbumSecondaryNav: new prev/next
Diffstat (limited to 'src/content/dependencies/generateAlbumSecondaryNavSeriesPart.js')
-rw-r--r--src/content/dependencies/generateAlbumSecondaryNavSeriesPart.js64
1 files changed, 24 insertions, 40 deletions
diff --git a/src/content/dependencies/generateAlbumSecondaryNavSeriesPart.js b/src/content/dependencies/generateAlbumSecondaryNavSeriesPart.js
index 47ba6ef6..12c72fd4 100644
--- a/src/content/dependencies/generateAlbumSecondaryNavSeriesPart.js
+++ b/src/content/dependencies/generateAlbumSecondaryNavSeriesPart.js
@@ -3,7 +3,7 @@ import {atOffset} from '#sugar';
 export default {
   contentDependencies: [
     'generateColorStyleAttribute',
-    'generatePreviousNextLinks',
+    'generateSecondaryNavParentSiblingsPart',
     'linkAlbumDynamically',
     'linkGroup',
   ],
@@ -29,15 +29,15 @@ export default {
   },
 
   relations: (relation, query, series, _album) => ({
+    parentSiblingsPart:
+      relation('generateSecondaryNavParentSiblingsPart'),
+
     groupLink:
       relation('linkGroup', series.group),
 
     colorStyle:
       relation('generateColorStyleAttribute', series.group.color),
 
-    previousNextLinks:
-      relation('generatePreviousNextLinks'),
-
     previousAlbumLink:
       (query.previousAlbum
         ? relation('linkAlbumDynamically', query.previousAlbum)
@@ -60,40 +60,24 @@ export default {
     },
   },
 
-  generate: (data, relations, slots, {html, language}) =>
-    html.tag('span',
-      {class: 'nav-link'},
-      {class: 'series-nav-link'},
-
-      relations.colorStyle
-        .slot('context', 'primary-only'),
-
-      language.encapsulate('albumSecondaryNav.series', workingCapsule => {
-        const workingOptions = {};
-
-        workingOptions.series =
-          relations.groupLink.slots({
-            attributes: {class: 'series'},
-            color: false,
-            content: language.sanitize(data.name),
-          });
-
-        if (slots.mode === 'album') {
-          const {previousNextLinks} = relations;
-
-          previousNextLinks.setSlots({
-            previousLink: relations.previousAlbumLink,
-            nextLink: relations.nextAlbumLink,
-            id: false,
-          });
-
-          if (!html.isBlank(previousNextLinks)) {
-            workingCapsule += '.withPreviousNext';
-            workingOptions.previousNext =
-              language.formatUnitList(previousNextLinks.content);
-          }
-        }
-
-        return language.$(workingCapsule, workingOptions);
-      })),
+  generate: (data, relations, slots, {language}) =>
+    relations.parentSiblingsPart.slots({
+      mode: slots.mode,
+
+      attributes: {class: 'series-nav-link'},
+
+      colorStyle: relations.colorStyle,
+
+      mainLink:
+        relations.groupLink.slots({
+          attributes: {class: 'series'},
+          content: language.sanitize(data.name),
+        }),
+
+      previousLink: relations.previousAlbumLink,
+      nextLink: relations.nextAlbumLink,
+
+      stringsKey: 'albumSecondaryNav.series',
+      mainLinkOption: 'series',
+    }),
 };