« get me outta code hell

generateGroupGalleryPage: incl. # of tracks, duration in grid info - 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-23 20:18:58 -0300
committer(quasar) nebula <qznebula@protonmail.com>2023-06-23 20:18:58 -0300
commit1925d95bc715aa5b0cefb701a90defd57b401083 (patch)
tree3eb0fe6c9d3cfc0884a58e451a621044e5eba161
parentee379f01bb93c3de839ade397eb171fae34d2a6b (diff)
generateGroupGalleryPage: incl. # of tracks, duration in grid info
-rw-r--r--src/content/dependencies/generateGroupGalleryPage.js12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/content/dependencies/generateGroupGalleryPage.js b/src/content/dependencies/generateGroupGalleryPage.js
index 168bf799..d7984416 100644
--- a/src/content/dependencies/generateGroupGalleryPage.js
+++ b/src/content/dependencies/generateGroupGalleryPage.js
@@ -103,6 +103,9 @@ export default {
     data.totalDuration = getTotalDuration(tracks, {originalReleasesOnly: true});
 
     data.gridNames = albums.map(album => album.name);
+    data.gridDurations = albums.map(album => getTotalDuration(album.tracks));
+    data.gridNumTracks = albums.map(album => album.tracks.length);
+
     data.gridPaths =
       albums.map(album =>
         (album.hasCoverArt
@@ -186,6 +189,15 @@ export default {
                           album: name,
                         }),
                     })),
+              info:
+                stitchArrays({
+                  numTracks: data.gridNumTracks,
+                  duration: data.gridDurations,
+                }).map(({numTracks, duration}) =>
+                    language.$('misc.albumGrid.details', {
+                      tracks: language.countTracks(numTracks, {unit: true}),
+                      time: language.formatDuration(duration),
+                    })),
             }),
         ],