« get me outta code hell

hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/content/dependencies/listAlbumsByTracks.js23
-rw-r--r--src/strings-default.yaml1
2 files changed, 19 insertions, 5 deletions
diff --git a/src/content/dependencies/listAlbumsByTracks.js b/src/content/dependencies/listAlbumsByTracks.js
index 36bda4f4..1f20401c 100644
--- a/src/content/dependencies/listAlbumsByTracks.js
+++ b/src/content/dependencies/listAlbumsByTracks.js
@@ -20,7 +20,10 @@ export default {
     filterByCount(albums, counts);
     sortByCount(albums, counts, {greatestFirst: true});
 
-    return {spec, albums, counts};
+    const styles =
+      albums.map(album => album.style);
+
+    return {spec, albums, counts, styles};
   },
 
   relations(relation, query) {
@@ -36,6 +39,7 @@ export default {
   data(query) {
     return {
       counts: query.counts,
+      styles: query.styles,
     };
   },
 
@@ -46,10 +50,19 @@ export default {
         stitchArrays({
           link: relations.albumLinks,
           count: data.counts,
-        }).map(({link, count}) => ({
-            album: link,
-            tracks: language.countTracks(count, {unit: true}),
-          })),
+          style: data.styles,
+        }).map(({link, count, style}) => {
+            const row = {
+              album: link,
+              tracks: language.countTracks(count, {unit: true}),
+            };
+
+            if (style === 'single') {
+              row.stringsKey = 'single';
+            }
+
+            return row;
+          }),
     });
   },
 };
diff --git a/src/strings-default.yaml b/src/strings-default.yaml
index 372f64c3..eed7b9b7 100644
--- a/src/strings-default.yaml
+++ b/src/strings-default.yaml
@@ -1872,6 +1872,7 @@ listingPage:
       title: "Albums - by Tracks"
       title.short: "...by Tracks"
       item: "{ALBUM} ({TRACKS})"
+      item.single: "{ALBUM} ({TRACKS}—single)"
 
     # listAlbums.byDuration:
     #   Lists albums by total duration of all tracks, longest to