« get me outta code hell

content: generateAlbumSidebar: fix up messy box passing - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2024-10-19 20:32:54 -0300
committer(quasar) nebula <qznebula@protonmail.com>2024-11-02 22:12:50 -0300
commit3a7e5ebf3adf0232768c667f868dfea615fa161c (patch)
tree736b6e8216b0d824d4eb85af7d79f18301bfffd1 /src
parentdf119fccb34e6912535ff6b9920826d9bfc54e59 (diff)
content: generateAlbumSidebar: fix up messy box passing
Diffstat (limited to 'src')
-rw-r--r--src/content/dependencies/generateAlbumSidebar.js33
1 files changed, 17 insertions, 16 deletions
diff --git a/src/content/dependencies/generateAlbumSidebar.js b/src/content/dependencies/generateAlbumSidebar.js
index 3dbe3867..3557a178 100644
--- a/src/content/dependencies/generateAlbumSidebar.js
+++ b/src/content/dependencies/generateAlbumSidebar.js
@@ -61,24 +61,21 @@ export default {
         data.isAlbumPage ? 'album' : 'track');
     }
 
-    const groupAndSeriesBoxes =
-      stitchArrays({
-        groupBox: relations.groupBoxes,
-        seriesBoxes: relations.seriesBoxes,
-      }).map(({groupBox, seriesBoxes}) =>
-          [groupBox].concat(
-            seriesBoxes.map(seriesBox => [
-              html.tag('div',
-                {class: 'sidebar-box-joiner'},
-                {class: 'collapsible'}),
-              seriesBox,
-            ])))
-        .flat();
-
     return relations.sidebar.slots({
       boxes: [
         data.isAlbumPage &&
-          groupAndSeriesBoxes,
+          stitchArrays({
+            groupBox: relations.groupBoxes,
+            seriesBoxes: relations.seriesBoxes,
+          }).map(({groupBox, seriesBoxes}) => [
+              groupBox,
+              seriesBoxes.map(seriesBox => [
+                html.tag('div',
+                  {class: 'sidebar-box-joiner'},
+                  {class: 'collapsible'}),
+                seriesBox,
+              ]),
+            ]),
 
         relations.trackListBox,
 
@@ -86,7 +83,11 @@ export default {
           relations.conjoinedBox.slots({
             attributes: {class: 'conjoined-group-sidebar-box'},
             boxes:
-              groupAndSeriesBoxes
+              stitchArrays({
+                groupBox: relations.groupBoxes,
+                seriesBoxes: relations.seriesBoxes,
+              }).map(({groupBox, seriesBoxes}) => [groupBox, ...seriesBoxes])
+                .flat()
                 .map(box => box.content), /* TODO: Kludge. */
           }),
       ],