« 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
diff options
context:
space:
mode:
Diffstat (limited to 'src/content')
-rw-r--r--src/content/dependencies/generateAlbumSidebar.js5
-rw-r--r--src/content/dependencies/generateAlbumSidebarGroupBox.js11
2 files changed, 9 insertions, 7 deletions
diff --git a/src/content/dependencies/generateAlbumSidebar.js b/src/content/dependencies/generateAlbumSidebar.js
index bf6b091a..a84f4357 100644
--- a/src/content/dependencies/generateAlbumSidebar.js
+++ b/src/content/dependencies/generateAlbumSidebar.js
@@ -7,7 +7,6 @@ export default {
 
   extraDependencies: ['html'],
 
-
   relations(relation, album, track) {
     const relations = {};
 
@@ -41,7 +40,7 @@ export default {
     if (data.isAlbumPage) {
       const groupBoxes =
         relations.groupBoxes
-          .map(content => content.slot('isAlbumPage', true))
+          .map(content => content.slot('mode', 'album'))
           .map(content => ({content}));
 
       return {
@@ -56,7 +55,7 @@ export default {
       content:
         relations.groupBoxes
           .flatMap((content, i, {length}) => [
-            content,
+            content.slot('mode', 'track'),
             i < length - 1 &&
               html.tag('hr', {
                 style: `border-color: var(--primary-color); border-style: none none dotted none`
diff --git a/src/content/dependencies/generateAlbumSidebarGroupBox.js b/src/content/dependencies/generateAlbumSidebarGroupBox.js
index e124acd9..874dcc20 100644
--- a/src/content/dependencies/generateAlbumSidebarGroupBox.js
+++ b/src/content/dependencies/generateAlbumSidebarGroupBox.js
@@ -46,7 +46,10 @@ export default {
   },
 
   slots: {
-    isAlbumPage: {type: 'boolean', default: false},
+    mode: {
+      validate: v => v.is('album', 'track'),
+      default: 'track',
+    },
   },
 
   generate(relations, slots, {html, language}) {
@@ -56,7 +59,7 @@ export default {
           group: relations.groupLink,
         })),
 
-      slots.isAlbumPage &&
+      slots.mode === 'album' &&
         relations.description
           ?.slot('mode', 'multiline'),
 
@@ -66,14 +69,14 @@ export default {
             links: language.formatDisjunctionList(relations.externalLinks),
           })),
 
-      slots.isAlbumPage &&
+      slots.mode === 'album' &&
       relations.nextAlbumLink &&
         html.tag('p', {class: 'group-chronology-link'},
           language.$('albumSidebar.groupBox.next', {
             album: relations.nextAlbumLink,
           })),
 
-      slots.isAlbumPage &&
+      slots.mode === 'album' &&
       relations.previousAlbumLink &&
         html.tag('p', {class: 'group-chronology-link'},
           language.$('albumSidebar.groupBox.previous', {