« get me outta code hell

content: gAIPFlashesChunkedList: general refactor a la tracks - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/content/dependencies/generateArtistInfoPageFlashesChunk.js
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2024-05-31 23:21:56 -0300
committer(quasar) nebula <qznebula@protonmail.com>2024-06-12 17:26:53 -0300
commit42a06333e4ebf98f22cbb7a856ff4517ee47fcb1 (patch)
tree0ab767330b2acf1a7ff0a0e6cadd2a8339bfca22 /src/content/dependencies/generateArtistInfoPageFlashesChunk.js
parent82c2cabd5f27bbb1989e7bd6af210f62b37b18c5 (diff)
content: gAIPFlashesChunkedList: general refactor a la tracks
Diffstat (limited to 'src/content/dependencies/generateArtistInfoPageFlashesChunk.js')
-rw-r--r--src/content/dependencies/generateArtistInfoPageFlashesChunk.js34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/content/dependencies/generateArtistInfoPageFlashesChunk.js b/src/content/dependencies/generateArtistInfoPageFlashesChunk.js
new file mode 100644
index 00000000..8aa7223a
--- /dev/null
+++ b/src/content/dependencies/generateArtistInfoPageFlashesChunk.js
@@ -0,0 +1,34 @@
+export default {
+  contentDependencies: [
+    'generateArtistInfoPageChunk',
+    'generateArtistInfoPageFlashesChunkItem',
+    'linkFlashAct',
+  ],
+
+  relations: (relation, flashAct, contribs) => ({
+    template:
+      relation('generateArtistInfoPageChunk'),
+
+    flashActLink:
+      relation('linkFlashAct', flashAct),
+
+    items:
+      contribs
+        .map(contrib =>
+          relation('generateArtistInfoPageFlashesChunkItem', contrib)),
+  }),
+
+  data: (_flashAct, contribs) => ({
+    dates:
+      contribs
+        .map(contrib => contrib.date),
+  }),
+
+  generate: (data, relations) =>
+    relations.template.slots({
+      mode: 'flash',
+      flashActLink: relations.flashActLink,
+      dates: data.dates,
+      items: relations.items,
+    }),
+};