« get me outta code hell

content: generate{Track,Album}InfoPage: handle null cover properly - 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-06-08 10:32:07 -0300
committer(quasar) nebula <qznebula@protonmail.com>2023-06-08 10:32:07 -0300
commitc36d6b999a554733ad4f3397f8047eb9f40db95e (patch)
treee7712dda16a7ac6780880d12ab1a384d6f67c602
parente1f8beeb384ad4a1a30f2654e17008ae730adf56 (diff)
content: generate{Track,Album}InfoPage: handle null cover properly
-rw-r--r--src/content/dependencies/generateAlbumInfoPage.js9
-rw-r--r--src/content/dependencies/generateTrackInfoPage.js10
2 files changed, 11 insertions, 8 deletions
diff --git a/src/content/dependencies/generateAlbumInfoPage.js b/src/content/dependencies/generateAlbumInfoPage.js
index b049f90e..1e8fa194 100644
--- a/src/content/dependencies/generateAlbumInfoPage.js
+++ b/src/content/dependencies/generateAlbumInfoPage.js
@@ -208,10 +208,11 @@ export default {
         additionalStyleRules: [relations.albumStyleRules],
 
         cover:
-          relations.cover
-            ?.slots({
-              alt: language.$('misc.alt.albumCover'),
-            }),
+          (relations.cover
+            ? relations.cover.slots({
+                alt: language.$('misc.alt.albumCover'),
+              })
+            : null),
 
         mainContent: [
           html.tag('p',
diff --git a/src/content/dependencies/generateTrackInfoPage.js b/src/content/dependencies/generateTrackInfoPage.js
index 7d306715..745e367e 100644
--- a/src/content/dependencies/generateTrackInfoPage.js
+++ b/src/content/dependencies/generateTrackInfoPage.js
@@ -359,10 +359,12 @@ export default {
         colorStyleRules: [relations.colorStyleRules],
         additionalStyleRules: [relations.albumStyleRules],
 
-        cover: relations.cover
-          ?.slots({
-            alt: language.$('misc.alt.trackCover'),
-          }),
+        cover:
+          (relations.cover
+            ? relations.cover.slots({
+                alt: language.$('misc.alt.trackCover'),
+              })
+            : null),
 
         mainContent: [
           html.tag('p', {