« get me outta code hell

content: generateAlbumCommentaryPage: album release date - 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>2024-12-19 13:00:35 -0400
committer(quasar) nebula <qznebula@protonmail.com>2024-12-19 13:25:17 -0400
commit1051d317def3c5adef12c45e5cbf863c56d54483 (patch)
tree49197df154687b925caf622446e86a36c153b4b1 /src/content/dependencies
parent3773a6b0040a9f48df2bf0aeb7f942e146c3f85c (diff)
content: generateAlbumCommentaryPage: album release date
Diffstat (limited to 'src/content/dependencies')
-rw-r--r--src/content/dependencies/generateAlbumCommentaryPage.js51
1 files changed, 32 insertions, 19 deletions
diff --git a/src/content/dependencies/generateAlbumCommentaryPage.js b/src/content/dependencies/generateAlbumCommentaryPage.js
index eb07a226..b78fd24e 100644
--- a/src/content/dependencies/generateAlbumCommentaryPage.js
+++ b/src/content/dependencies/generateAlbumCommentaryPage.js
@@ -97,6 +97,7 @@ export default {
 
     data.name = album.name;
     data.color = album.color;
+    data.date = album.date;
 
     const tracksWithCommentary =
       album.tracks
@@ -150,25 +151,37 @@ export default {
         mainClasses: ['long-content'],
         mainContent: [
           html.tag('p',
-            language.encapsulate(pageCapsule, 'infoLine', workingCapsule => {
-              const workingOptions = {};
-
-              if (data.entryCount >= 1) {
-                workingOptions.words =
-                  html.tag('b',
-                    language.formatWordCount(data.wordCount, {unit: true}));
-
-                workingOptions.entries =
-                  html.tag('b',
-                    language.countCommentaryEntries(data.entryCount, {unit: true}));
-              }
-
-              if (data.entryCount === 0) {
-                workingCapsule += '.withoutCommentary';
-              }
-
-              return language.$(workingCapsule, workingOptions);
-            })),
+            {[html.joinChildren]: html.tag('br')},
+
+            [
+              data.date &&
+              data.entryCount >= 1 &&
+                language.$('releaseInfo.albumReleased', {
+                  date:
+                    html.tag('b',
+                      language.formatDate(data.date)),
+                }),
+
+              language.encapsulate(pageCapsule, 'infoLine', workingCapsule => {
+                const workingOptions = {};
+
+                if (data.entryCount >= 1) {
+                  workingOptions.words =
+                    html.tag('b',
+                      language.formatWordCount(data.wordCount, {unit: true}));
+
+                  workingOptions.entries =
+                    html.tag('b',
+                      language.countCommentaryEntries(data.entryCount, {unit: true}));
+                }
+
+                if (data.entryCount === 0) {
+                  workingCapsule += '.withoutCommentary';
+                }
+
+                return language.$(workingCapsule, workingOptions);
+              })
+            ]),
 
           relations.albumCommentaryEntries &&
             language.encapsulate(pageCapsule, 'entry', entryCapsule => [