« get me outta code hell

content: generateGroupInfoPage: use datetimestamps - 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>2023-11-29 17:58:07 -0400
committer(quasar) nebula <qznebula@protonmail.com>2023-11-29 17:58:07 -0400
commit301ae482ee60897db13d5fd76b9ce7c9df5790f2 (patch)
tree9fb2242d3b00165a07b1462a911e202e49404659 /src
parenta0fa6520c77e46b7a2e55b87e9994df3af74f149 (diff)
content: generateGroupInfoPage: use datetimestamps
Diffstat (limited to 'src')
-rw-r--r--src/content/dependencies/generateGroupInfoPage.js20
1 files changed, 12 insertions, 8 deletions
diff --git a/src/content/dependencies/generateGroupInfoPage.js b/src/content/dependencies/generateGroupInfoPage.js
index 04886fe2..5bf2b1bf 100644
--- a/src/content/dependencies/generateGroupInfoPage.js
+++ b/src/content/dependencies/generateGroupInfoPage.js
@@ -2,6 +2,7 @@ import {empty, stitchArrays} from '#sugar';
 
 export default {
   contentDependencies: [
+    'generateAbsoluteDatetimestamp',
     'generateContentHeading',
     'generateGroupNavLinks',
     'generateGroupSecondaryNav',
@@ -73,6 +74,12 @@ export default {
             (group
               ? relation('linkGroup', group)
               : null));
+
+      sec.albums.datetimestamps =
+        group.albums.map(album =>
+          (album.date
+            ? relation('generateAbsoluteDatetimestamp', album.date)
+            : null));
     }
 
     return relations;
@@ -84,10 +91,6 @@ export default {
     data.name = group.name;
     data.color = group.color;
 
-    data.albumYears =
-      group.albums
-        .map(album => album.date?.getFullYear());
-
     return data;
   },
 
@@ -133,17 +136,18 @@ export default {
               stitchArrays({
                 albumLink: sec.albums.albumLinks,
                 groupLink: sec.albums.groupLinks,
-                albumYear: data.albumYears,
-              }).map(({albumLink, groupLink, albumYear}) => {
+                datetimestamp: sec.albums.datetimestamps,
+              }).map(({albumLink, groupLink, datetimestamp}) => {
                   const prefix = 'groupInfoPage.albumList.item';
                   const parts = [prefix];
                   const options = {album: albumLink};
 
-                  if (albumYear) {
+                  if (datetimestamp) {
                     parts.push('withYear');
                     options.yearAccent =
                       language.$(prefix, 'yearAccent', {
-                        year: albumYear,
+                        year:
+                          datetimestamp.slots({style: 'year', tooltip: true}),
                       });
                   }