« 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
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
parent3773a6b0040a9f48df2bf0aeb7f942e146c3f85c (diff)
content: generateAlbumCommentaryPage: album release date
Diffstat (limited to 'src')
-rw-r--r--src/content/dependencies/generateAlbumCommentaryPage.js51
-rw-r--r--src/strings-default.yaml1
2 files changed, 33 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 => [
diff --git a/src/strings-default.yaml b/src/strings-default.yaml
index a3388472..e1e75bb1 100644
--- a/src/strings-default.yaml
+++ b/src/strings-default.yaml
@@ -260,6 +260,7 @@ releaseInfo:
   bannerArtBy: "Banner art by {ARTISTS}."
 
   released: "Released {DATE}."
+  albumReleased: "Album released {DATE}."
   artReleased: "Art released {DATE}."
   addedToWiki: "Added to wiki {DATE}."