« get me outta code hell

content: generateAlbimSidebarTrackSection: handle commentary-less tracks - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2023-10-23 13:49:20 -0300
committer(quasar) nebula <qznebula@protonmail.com>2023-10-23 13:49:20 -0300
commit22b1823dd82bf4fd2063d121c743d02e452fe7f3 (patch)
treec724e84bb4dac1904cdcf118296642cd8ced76a4
parent63075c650bf990407e9eefe3e9f135b2425a2ded (diff)
content: generateAlbimSidebarTrackSection: handle commentary-less tracks
-rw-r--r--src/content/dependencies/generateAlbumCommentaryPage.js1
-rw-r--r--src/content/dependencies/generateAlbumSidebarTrackSection.js24
-rw-r--r--src/static/site5.css4
3 files changed, 26 insertions, 3 deletions
diff --git a/src/content/dependencies/generateAlbumCommentaryPage.js b/src/content/dependencies/generateAlbumCommentaryPage.js
index 2982b037..3ad1549e 100644
--- a/src/content/dependencies/generateAlbumCommentaryPage.js
+++ b/src/content/dependencies/generateAlbumCommentaryPage.js
@@ -207,6 +207,7 @@ export default {
             section.slots({
               anchor: true,
               open: true,
+              mode: 'commentary',
             })),
         ],
       });
diff --git a/src/content/dependencies/generateAlbumSidebarTrackSection.js b/src/content/dependencies/generateAlbumSidebarTrackSection.js
index 00e9b621..d3cd37f0 100644
--- a/src/content/dependencies/generateAlbumSidebarTrackSection.js
+++ b/src/content/dependencies/generateAlbumSidebarTrackSection.js
@@ -37,12 +37,21 @@ export default {
       trackSection.tracks
         .map(track => track.directory);
 
+    data.tracksAreMissingCommentary =
+      trackSection.tracks
+        .map(track => !track.commentary);
+
     return data;
   },
 
   slots: {
     anchor: {type: 'boolean'},
     open: {type: 'boolean'},
+
+    mode: {
+      validate: v => v.is('info', 'commentary'),
+      default: 'info',
+    },
   },
 
   generate(data, relations, slots, {getColors, html, language}) {
@@ -62,14 +71,23 @@ export default {
       relations.trackLinks.map((trackLink, index) =>
         html.tag('li',
           {
-            class:
+            class: [
               data.includesCurrentTrack &&
               index === data.currentTrackIndex &&
-              'current',
+                'current',
+
+              slots.mode === 'commentary' &&
+              data.tracksAreMissingCommentary[index] &&
+                'no-commentary',
+            ],
           },
           language.$('albumSidebar.trackList.item', {
             track:
-              (slots.anchor
+              (slots.mode === 'commentary' && data.tracksAreMissingCommentary[index]
+                ? trackLink.slots({
+                    linkless: true,
+                  })
+             : slots.anchor
                 ? trackLink.slots({
                     anchor: true,
                     hash: data.trackDirectories[index],
diff --git a/src/static/site5.css b/src/static/site5.css
index d50d4623..0eb7dcda 100644
--- a/src/static/site5.css
+++ b/src/static/site5.css
@@ -794,6 +794,10 @@ li > ul {
   display: none;
 }
 
+html[data-url-key="localized.albumCommentary"] li.no-commentary {
+  opacity: 0.7;
+}
+
 /* Images */
 
 .image-container {