« get me outta code hell

content: generateGroupInfoPageAlbumsListBySeries - 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-10-14 17:16:14 -0300
committer(quasar) nebula <qznebula@protonmail.com>2024-11-02 22:12:48 -0300
commitc65e1e3c36e32cd6b0d8e7ca2f730b71b4185ed9 (patch)
tree57e8895ee53715cda912e857f63d42b9595f7681 /src
parent0892fa93e6eeb14c9646f2d50c131b99a2f17999 (diff)
content: generateGroupInfoPageAlbumsListBySeries
Diffstat (limited to 'src')
-rw-r--r--src/content/dependencies/generateGroupInfoPageAlbumsListBySeries.js54
-rw-r--r--src/content/dependencies/generateGroupInfoPageAlbumsSection.js5
-rw-r--r--src/static/css/site.css6
-rw-r--r--src/strings-default.yaml4
4 files changed, 67 insertions, 2 deletions
diff --git a/src/content/dependencies/generateGroupInfoPageAlbumsListBySeries.js b/src/content/dependencies/generateGroupInfoPageAlbumsListBySeries.js
new file mode 100644
index 00000000..8fa90877
--- /dev/null
+++ b/src/content/dependencies/generateGroupInfoPageAlbumsListBySeries.js
@@ -0,0 +1,54 @@
+import {stitchArrays} from '#sugar';
+
+export default {
+  contentDependencies: [
+    'generateContentHeading',
+    'generateGroupInfoPageAlbumsListItem',
+  ],
+
+  extraDependencies: ['html', 'language'],
+
+  relations: (relation, group) => ({
+    seriesHeadings:
+      group.serieses
+        .map(() => relation('generateContentHeading')),
+
+    seriesItems:
+      group.serieses
+        .map(series => series.albums
+          .map(album =>
+            relation('generateGroupInfoPageAlbumsListItem',
+              album,
+              group))),
+  }),
+
+  data: (group) => ({
+    seriesNames:
+      group.serieses
+        .map(series => series.name),
+  }),
+
+  generate: (data, relations, {html, language}) =>
+    language.encapsulate('groupInfoPage.albumList', listCapsule =>
+      html.tag('dl', {class: 'group-series-list'},
+        {[html.onlyIfContent]: true},
+
+        stitchArrays({
+          name: data.seriesNames,
+          heading: relations.seriesHeadings,
+          items: relations.seriesItems,
+        }).map(({heading, name, items}) =>
+            html.tags([
+              heading.slots({
+                tag: 'dt',
+                title:
+                  language.$(listCapsule, 'series', {
+                    series: name,
+                  }),
+              }),
+
+              html.tag('dd',
+                html.tag('ul',
+                  items)),
+            ])))),
+};
diff --git a/src/content/dependencies/generateGroupInfoPageAlbumsSection.js b/src/content/dependencies/generateGroupInfoPageAlbumsSection.js
index 6737bd98..90e0bd8a 100644
--- a/src/content/dependencies/generateGroupInfoPageAlbumsSection.js
+++ b/src/content/dependencies/generateGroupInfoPageAlbumsSection.js
@@ -2,6 +2,7 @@ export default {
   contentDependencies: [
     'generateContentHeading',
     'generateGroupInfoPageAlbumsListByDate',
+    'generateGroupInfoPageAlbumsListBySeries',
     'linkGroupGallery',
   ],
 
@@ -16,6 +17,9 @@ export default {
 
     albumsListByDate:
       relation('generateGroupInfoPageAlbumsListByDate', group),
+
+    albumsListBySeries:
+      relation('generateGroupInfoPageAlbumsListBySeries', group),
   }),
 
   generate: (relations, {html, language}) =>
@@ -39,5 +43,6 @@ export default {
               }))),
 
           relations.albumsListByDate,
+          relations.albumsListBySeries,
         ]))),
 };
diff --git a/src/static/css/site.css b/src/static/css/site.css
index e501cf88..b49464e0 100644
--- a/src/static/css/site.css
+++ b/src/static/css/site.css
@@ -1560,12 +1560,14 @@ ul > li.has-details {
   margin-left: -17px;
 }
 
-.album-group-list dt {
+.album-group-list dt,
+.group-series-list dt {
   font-style: oblique;
   padding-left: 0;
 }
 
-.album-group-list dd {
+.album-group-list dd,
+.group-series-list dd {
   margin-left: 0;
 }
 
diff --git a/src/strings-default.yaml b/src/strings-default.yaml
index ffd094a9..146facee 100644
--- a/src/strings-default.yaml
+++ b/src/strings-default.yaml
@@ -1286,6 +1286,10 @@ groupInfoPage:
   albumList:
     title: "Albums"
 
+    series:
+      _: >-
+        {SERIES}:
+
     item:
       _: >-
         {ALBUM}