« get me outta code hell

content: generateTrackInfoPage: simpler commentary/lyrics layout - 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-06-12 13:59:23 -0300
committer(quasar) nebula <qznebula@protonmail.com>2024-06-18 22:56:09 -0300
commita0a58585b8794ceb97d2610791c9438b105c712f (patch)
tree86b7baa8b747d842c807f4f4fd79fac227d78320 /src/content
parent715d04fed0dc45d0479dae79d6eed2c564479794 (diff)
content: generateTrackInfoPage: simpler commentary/lyrics layout
Diffstat (limited to 'src/content')
-rw-r--r--src/content/dependencies/generateTrackInfoPage.js26
1 files changed, 10 insertions, 16 deletions
diff --git a/src/content/dependencies/generateTrackInfoPage.js b/src/content/dependencies/generateTrackInfoPage.js
index d78c2703..d44761f6 100644
--- a/src/content/dependencies/generateTrackInfoPage.js
+++ b/src/content/dependencies/generateTrackInfoPage.js
@@ -122,12 +122,8 @@ export default {
 
     // Section: Lyrics
 
-    if (track.lyrics) {
-      const lyrics = sections.lyrics = {};
-
-      lyrics.content =
-        relation('transformContent', track.lyrics);
-    }
+    relations.lyrics =
+      relation('transformContent', track.lyrics);
 
     // Sections: Sheet music files, MIDI/proejct files, additional files
 
@@ -148,10 +144,8 @@ export default {
 
     // Section: Artist commentary
 
-    if (track.commentary) {
-      sections.artistCommentary =
-        relation('generateCommentarySection', track.commentary);
-    }
+    relations.artistCommentarySection =
+      relation('generateCommentarySection', track.commentary);
 
     return relations;
   },
@@ -215,7 +209,7 @@ export default {
                     language.$('releaseInfo.additionalFiles.shortcut.link')),
                 }),
 
-              sec.artistCommentary &&
+              !html.isBlank(relations.artistCommentarySection) &&
                 language.$('releaseInfo.readCommentary', {
                   link: html.tag('a',
                     {href: '#artist-commentary'},
@@ -334,7 +328,7 @@ export default {
             relations.flashesThatFeatureList,
           ]),
 
-          sec.lyrics && [
+          html.tags([
             relations.contentHeading.clone()
               .slots({
                 attributes: {id: 'lyrics'},
@@ -342,9 +336,9 @@ export default {
               }),
 
             html.tag('blockquote',
-              sec.lyrics.content
-                .slot('mode', 'lyrics')),
-          ],
+              {[html.onlyIfContent]: true},
+              relations.lyrics.slot('mode', 'lyrics')),
+          ]),
 
           html.tags([
             relations.contentHeading.clone()
@@ -376,7 +370,7 @@ export default {
             relations.additionalFilesList,
           ]),
 
-          sec.artistCommentary,
+          relations.artistCommentarySection,
         ],
 
         navLinkStyle: 'hierarchical',