« get me outta code hell

chronology tweaks & html.onlyIfContent bugfix - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/page
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2022-11-28 20:25:47 -0400
committer(quasar) nebula <qznebula@protonmail.com>2022-11-28 20:25:47 -0400
commitae9dba60c4bbb327b402c500cc042922a954de74 (patch)
tree81084937a13778104c29976e027e83a17c51f5fb /src/page
parent5206ac7188c9eefd6f1d18050e2831b0f10be8ef (diff)
chronology tweaks & html.onlyIfContent bugfix
Diffstat (limited to 'src/page')
-rw-r--r--src/page/album.js58
-rw-r--r--src/page/flash.js4
2 files changed, 34 insertions, 28 deletions
diff --git a/src/page/album.js b/src/page/album.js
index 741fcaba..cb512e86 100644
--- a/src/page/album.js
+++ b/src/page/album.js
@@ -580,8 +580,6 @@ export function generateAlbumChronologyLinks(album, currentTrack, {
   generateChronologyLinks,
   html,
 }) {
-  const isTrackPage = !!currentTrack;
-
   return html.tag(
     'div',
     {
@@ -589,34 +587,38 @@ export function generateAlbumChronologyLinks(album, currentTrack, {
       class: 'nav-chronology-links',
     },
     [
-      isTrackPage &&
-        generateChronologyLinks(currentTrack, {
-          contribKey: 'artistContribs',
-          getThings: (artist) => [
-            ...artist.tracksAsArtist,
-            ...artist.tracksAsContributor,
-          ],
-          headingString: 'misc.chronology.heading.track',
-        }),
+      ...html.fragment(
+        currentTrack && [
+          ...html.fragment(
+            generateChronologyLinks(currentTrack, {
+              contribKey: 'artistContribs',
+              getThings: (artist) => [
+                ...artist.tracksAsArtist,
+                ...artist.tracksAsContributor,
+              ],
+              headingString: 'misc.chronology.heading.track',
+            })),
 
-      isTrackPage &&
-        generateChronologyLinks(currentTrack, {
-          contribKey: 'contributorContribs',
+          ...html.fragment(
+            generateChronologyLinks(currentTrack, {
+              contribKey: 'contributorContribs',
+              getThings: (artist) => [
+                ...artist.tracksAsArtist,
+                ...artist.tracksAsContributor,
+              ],
+              headingString: 'misc.chronology.heading.track',
+            })),
+        ]),
+
+      ...html.fragment(
+        generateChronologyLinks(currentTrack || album, {
+          contribKey: 'coverArtistContribs',
+          dateKey: 'coverArtDate',
           getThings: (artist) => [
-            ...artist.tracksAsArtist,
-            ...artist.tracksAsContributor,
+            ...artist.albumsAsCoverArtist,
+            ...artist.tracksAsCoverArtist,
           ],
-          headingString: 'misc.chronology.heading.track',
-        }),
-
-      generateChronologyLinks(currentTrack || album, {
-        contribKey: 'coverArtistContribs',
-        dateKey: 'coverArtDate',
-        getThings: (artist) => [
-          ...artist.albumsAsCoverArtist,
-          ...artist.tracksAsCoverArtist,
-        ],
-        headingString: 'misc.chronology.heading.coverArt',
-      }),
+          headingString: 'misc.chronology.heading.coverArt',
+        })),
     ]);
 }
diff --git a/src/page/flash.js b/src/page/flash.js
index 1e818ae9..e5353a18 100644
--- a/src/page/flash.js
+++ b/src/page/flash.js
@@ -229,6 +229,10 @@ function generateNavForFlash(flash, {
     bottomRowContent: previousNextLinks && `(${previousNextLinks})`,
 
     content: html.tag('div',
+      {
+        [html.onlyIfContent]: true,
+        class: 'nav-chronology-links',
+      },
       generateChronologyLinks(flash, {
         headingString: 'misc.chronology.heading.flash',
         contribKey: 'contributorContribs',