« get me outta code hell

content: compute "needs reveal" class only on client - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/content/dependencies
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2023-06-08 10:27:42 -0300
committer(quasar) nebula <qznebula@protonmail.com>2023-06-08 10:27:42 -0300
commite1f8beeb384ad4a1a30f2654e17008ae730adf56 (patch)
tree29bc8d9f1266d9fec51b24f174f62c60338f7db3 /src/content/dependencies
parentaf6f7e78c5c148ac3b194170ee65a30f75ad5413 (diff)
content: compute "needs reveal" class only on client
Diffstat (limited to 'src/content/dependencies')
-rw-r--r--src/content/dependencies/generateAlbumInfoPage.js9
-rw-r--r--src/content/dependencies/generatePageLayout.js2
-rw-r--r--src/content/dependencies/generateStickyHeadingContainer.js10
-rw-r--r--src/content/dependencies/generateTrackInfoPage.js6
4 files changed, 4 insertions, 23 deletions
diff --git a/src/content/dependencies/generateAlbumInfoPage.js b/src/content/dependencies/generateAlbumInfoPage.js
index 42f4646f..b049f90e 100644
--- a/src/content/dependencies/generateAlbumInfoPage.js
+++ b/src/content/dependencies/generateAlbumInfoPage.js
@@ -173,12 +173,8 @@ export default {
     data.duration = accumulateSum(album.tracks, track => track.duration);
     data.durationApproximate = album.tracks.length > 1;
 
-    if (album.hasCoverArt) {
-      data.coverNeedsReveal = album.artTags.some(t => t.isContentWarning);
-
-      if (album.coverArtDate && +album.coverArtDate !== +album.date) {
-        data.coverArtDate = album.coverArtDate;
-      }
+    if (album.coverArtDate && +album.coverArtDate !== +album.date) {
+      data.coverArtDate = album.coverArtDate;
     }
 
     if (!empty(album.additionalFiles)) {
@@ -216,7 +212,6 @@ export default {
             ?.slots({
               alt: language.$('misc.alt.albumCover'),
             }),
-        coverNeedsReveal: relations.content.coverNeedsReveal,
 
         mainContent: [
           html.tag('p',
diff --git a/src/content/dependencies/generatePageLayout.js b/src/content/dependencies/generatePageLayout.js
index 1853fb1e..f3745526 100644
--- a/src/content/dependencies/generatePageLayout.js
+++ b/src/content/dependencies/generatePageLayout.js
@@ -104,7 +104,6 @@ export default {
         showWikiNameInTitle: {type: 'boolean', default: true},
 
         cover: {type: 'html'},
-        coverNeedsReveal: {type: 'boolean'},
 
         socialEmbed: {type: 'html'},
 
@@ -204,7 +203,6 @@ export default {
                 relations.stickyHeadingContainer.slots({
                   title: slots.title,
                   cover: slots.cover,
-                  needsReveal: slots.coverNeedsReveal,
                 });
               break;
             case 'static':
diff --git a/src/content/dependencies/generateStickyHeadingContainer.js b/src/content/dependencies/generateStickyHeadingContainer.js
index fb6d8307..6602a2a3 100644
--- a/src/content/dependencies/generateStickyHeadingContainer.js
+++ b/src/content/dependencies/generateStickyHeadingContainer.js
@@ -8,7 +8,6 @@ export default {
       slots: {
         title: {type: 'html'},
         cover: {type: 'html'},
-        needsReveal: {type: 'boolean', default: false},
       },
 
       content(slots) {
@@ -27,13 +26,8 @@ export default {
 
               hasCover &&
                 html.tag('div', {class: 'content-sticky-heading-cover-container'},
-                  html.tag('div',
-                    {class: [
-                      'content-sticky-heading-cover',
-                      slots.needsReveal &&
-                        'content-sticky-heading-cover-needs-reveal',
-                    ]},
-                    slots.cover.slot('displayMode', 'thumbnail')))
+                  html.tag('div', {class: 'content-sticky-heading-cover'},
+                    slots.cover.slot('displayMode', 'thumbnail'))),
             ]),
 
             html.tag('div', {class: 'content-sticky-subheading-row'},
diff --git a/src/content/dependencies/generateTrackInfoPage.js b/src/content/dependencies/generateTrackInfoPage.js
index 67182e79..7d306715 100644
--- a/src/content/dependencies/generateTrackInfoPage.js
+++ b/src/content/dependencies/generateTrackInfoPage.js
@@ -319,7 +319,6 @@ export default {
       data.albumCoverArtDirectory = album.directory;
       data.trackCoverArtDirectory = track.directory;
       data.coverArtFileExtension = track.coverArtFileExtension;
-      data.coverNeedsReveal = track.artTags.some(t => t.isContentWarning);
 
       if (track.coverArtDate && +track.coverArtDate !== +track.date) {
         data.coverArtDate = track.coverArtDate;
@@ -327,9 +326,6 @@ export default {
     } else if (track.album.hasCoverArt) {
       data.albumCoverArtDirectory = album.directory;
       data.coverArtFileExtension = album.coverArtFileExtension;
-      data.coverNeedsReveal = album.artTags.some(t => t.isContentWarning);
-    } else {
-      data.coverNeedsReveal = null;
     }
 
     data.hasTrackNumbers = album.hasTrackNumbers;
@@ -368,8 +364,6 @@ export default {
             alt: language.$('misc.alt.trackCover'),
           }),
 
-        coverNeedsReveal: data.coverNeedsReveal,
-
         mainContent: [
           html.tag('p', {
             [html.onlyIfContent]: true,