« get me outta code hell

content, data: MusicVideo.contributorStyle - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/content/dependencies/generateMusicVideoContributors.js
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2026-01-31 23:01:14 -0400
committer(quasar) nebula <qznebula@protonmail.com>2026-01-31 23:03:12 -0400
commit180d3e169b10db5f1837567eca9bf1b2d5542b96 (patch)
tree80ac792949c3d9c40f5f748c4e5513450b702532 /src/content/dependencies/generateMusicVideoContributors.js
parente4faa8a4cbc08621a95413047370b2bda25bb3cb (diff)
content, data: MusicVideo.contributorStyle
Diffstat (limited to 'src/content/dependencies/generateMusicVideoContributors.js')
-rw-r--r--src/content/dependencies/generateMusicVideoContributors.js57
1 files changed, 57 insertions, 0 deletions
diff --git a/src/content/dependencies/generateMusicVideoContributors.js b/src/content/dependencies/generateMusicVideoContributors.js
new file mode 100644
index 00000000..055df5cc
--- /dev/null
+++ b/src/content/dependencies/generateMusicVideoContributors.js
@@ -0,0 +1,57 @@
+const contributionSlots = {
+  showAnnotation: true,
+  showChronology: true,
+  chronologyKind: 'musicVideoContribution',
+};
+
+export default {
+  relations: (relation, musicVideo) => ({
+    artistCredit:
+      relation('generateArtistCredit', musicVideo.contributorContribs, []),
+
+    contributionLinks:
+      musicVideo.contributorContribs
+        .map(contrib => relation('linkContribution', contrib)),
+  }),
+
+  data: (musicVideo) => ({
+    style:
+      musicVideo.contributorStyle,
+  }),
+
+  generate: (data, relations, {html, language}) =>
+    language.encapsulate('misc.musicVideo', capsule =>
+      (data.style === 'list'
+        ? html.tag('p',
+            {[html.joinChildren]: html.tag('br')},
+            {[html.onlyIfContent]: true},
+
+            [
+              html.tags([
+                language.$(capsule, 'contributorsList.title'),
+              ], {[html.onlyIfSiblings]: true}),
+
+              relations.contributionLinks
+                .map(link => link.slots({...contributionSlots})),
+            ])
+
+     : data.style === 'line'
+        ? html.tag('p',
+            {[html.onlyIfContent]: true},
+
+              language.$(capsule, 'contributorsLine', {
+                [language.onlyIfOptions]: ['credit'],
+
+                credit:
+                  relations.artistCredit.slots({
+                    normalStringKey:
+                      language.encapsulate(capsule, 'contributorsLine.credit'),
+
+                    chunkwrap: false,
+
+                    ...contributionSlots,
+                  }),
+              }))
+
+        : html.blank())),
+};