« get me outta code hell

hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/content/dependencies/generateAlbumSidebar.js67
1 files changed, 35 insertions, 32 deletions
diff --git a/src/content/dependencies/generateAlbumSidebar.js b/src/content/dependencies/generateAlbumSidebar.js
index ab659b99..bf6b091a 100644
--- a/src/content/dependencies/generateAlbumSidebar.js
+++ b/src/content/dependencies/generateAlbumSidebar.js
@@ -30,44 +30,47 @@ export default {
   },
 
   generate(data, relations, {html}) {
-    const {isAlbumPage} = data;
+    const trackListBox = {
+      content:
+        html.tags([
+          html.tag('h1', relations.albumLink),
+          relations.trackSections,
+        ]),
+    };
 
-    const trackListPart = html.tags([
-      html.tag('h1', relations.albumLink),
-      relations.trackSections,
-    ]);
+    if (data.isAlbumPage) {
+      const groupBoxes =
+        relations.groupBoxes
+          .map(content => content.slot('isAlbumPage', true))
+          .map(content => ({content}));
 
-    if (isAlbumPage) {
       return {
-        // leftSidebarStickyMode: 'last',
         leftSidebarMultiple: [
-          ...(
-            relations.groupBoxes
-              .map(groupBox => groupBox.slot('isAlbumPage', true))
-              .map(content => ({content}))),
-          {content: trackListPart},
-        ],
-      };
-    } else {
-      return {
-        // leftSidebarStickyMode: 'column',
-        leftSidebarMultiple: [
-          {content: trackListPart},
-          // ...relations.groupBoxes.map(content => ({content})),
-          {
-            content:
-              relations.groupBoxes
-                .flatMap((content, i, {length}) => [
-                  content,
-                  i < length - 1 &&
-                    html.tag('hr', {
-                      style: `border-color: var(--primary-color); border-style: none none dotted none`
-                    }),
-                ])
-                .filter(Boolean),
-          },
+          ...groupBoxes,
+          trackListBox,
         ],
       };
     }
+
+    const conjoinedGroupBox = {
+      content:
+        relations.groupBoxes
+          .flatMap((content, i, {length}) => [
+            content,
+            i < length - 1 &&
+              html.tag('hr', {
+                style: `border-color: var(--primary-color); border-style: none none dotted none`
+              }),
+          ])
+          .filter(Boolean),
+    };
+
+    return {
+      // leftSidebarStickyMode: 'column',
+      leftSidebarMultiple: [
+        trackListBox,
+        conjoinedGroupBox,
+      ],
+    };
   },
 };