« get me outta code hell

hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
diff options
context:
space:
mode:
-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. */
           }),
       ],