« get me outta code hell

content: generateAlbumNavAccent: stub commentary link - 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:
author(quasar) nebula <qznebula@protonmail.com>2024-12-19 12:57:03 -0400
committer(quasar) nebula <qznebula@protonmail.com>2024-12-19 13:25:17 -0400
commit3773a6b0040a9f48df2bf0aeb7f942e146c3f85c (patch)
tree620980e5f56b0c1b2b3e958c1c87276bd2da0f4f /src/content
parent916fc9c5c3b290602ac19e84269150ffbb7ab3b1 (diff)
content: generateAlbumNavAccent: stub commentary link
Diffstat (limited to 'src/content')
-rw-r--r--src/content/dependencies/generateAlbumNavAccent.js21
1 files changed, 10 insertions, 11 deletions
diff --git a/src/content/dependencies/generateAlbumNavAccent.js b/src/content/dependencies/generateAlbumNavAccent.js
index e5b3a23d..3adb01be 100644
--- a/src/content/dependencies/generateAlbumNavAccent.js
+++ b/src/content/dependencies/generateAlbumNavAccent.js
@@ -30,10 +30,6 @@ export default {
         ? atOffset(album.tracks, index, +1)
         : null);
 
-    query.albumHasAnyCommentary =
-      !!(album.commentary ||
-         album.tracks.some(t => t.commentary));
-
     return query;
   },
 
@@ -61,15 +57,17 @@ export default {
       relation('linkAlbumGallery', album),
 
     albumCommentaryLink:
-      (query.albumHasAnyCommentary
-        ? relation('linkAlbumCommentary', album)
-        : null),
+      relation('linkAlbumCommentary', album),
   }),
 
   data: (query, album, track) => ({
     hasMultipleTracks:
       album.tracks.length > 1,
 
+    commentaryPageIsStub:
+      !album.commentary &&
+      album.tracks.every(t => !t.commentary),
+
     galleryIsStub:
       album.tracks.every(t => !t.hasUniqueCoverArt),
 
@@ -106,10 +104,11 @@ export default {
         });
 
     const commentaryLink =
-      relations.albumCommentaryLink?.slots({
-        attributes: {class: slots.currentExtra === 'commentary' && 'current'},
-        content: language.$(albumNavCapsule, 'commentary'),
-      });
+      (!data.commentaryPageIsStub || slots.currentExtra === 'commentary') &&
+        relations.albumCommentaryLink.slots({
+          attributes: {class: slots.currentExtra === 'commentary' && 'current'},
+          content: language.$(albumNavCapsule, 'commentary'),
+        });
 
     const randomLink =
       data.hasMultipleTracks &&