« get me outta code hell

content, css: generateMusicVideoDateLine - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/content/dependencies/generateMusicVideoArtistsLine.js
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2026-01-17 19:18:26 -0400
committer(quasar) nebula <qznebula@protonmail.com>2026-01-17 19:18:26 -0400
commit9816f00277292f499e47b9df7bbc89a385bcb133 (patch)
tree7d876eb3ef9d9e5aef6f77ed5d91431f7ce28ec1 /src/content/dependencies/generateMusicVideoArtistsLine.js
parent85fa29d1cef35f7b3ba977b35dc913d39d3268be (diff)
content, css: generateMusicVideoDateLine
Diffstat (limited to 'src/content/dependencies/generateMusicVideoArtistsLine.js')
-rw-r--r--src/content/dependencies/generateMusicVideoArtistsLine.js41
1 files changed, 41 insertions, 0 deletions
diff --git a/src/content/dependencies/generateMusicVideoArtistsLine.js b/src/content/dependencies/generateMusicVideoArtistsLine.js
new file mode 100644
index 00000000..959d3648
--- /dev/null
+++ b/src/content/dependencies/generateMusicVideoArtistsLine.js
@@ -0,0 +1,41 @@
+export default {
+  relations: (relation, musicVideo) => ({
+    artistCredit:
+      relation('generateArtistCredit', musicVideo.artistContribs, []),
+  }),
+
+  data: (musicVideo) => ({
+    label:
+      (musicVideo.label !== 'Music video'
+        ? musicVideo.label
+        : null),
+  }),
+
+  generate(data, relations, {html, language}) {
+    const {artistCredit} = relations;
+    const capsule = language.encapsulate('misc.musicVideo');
+
+    let artistsLineCapsule = language.encapsulate(capsule, 'artistsLine');
+    let artistsLineOptions = {[language.onlyIfOptions]: ['credit']};
+
+    if (data.label) {
+      artistsLineCapsule += '.customLabel';
+      artistsLineOptions.label = data.label;
+    }
+
+    artistsLineOptions.credit =
+      html.tag('span', {class: 'by'},
+        {[html.onlyIfContent]: true},
+
+        artistCredit.slots({
+          normalStringKey: language.encapsulate(capsule, 'artistsLine.credit'),
+
+          showAnnotation: true,
+          showChronology: true,
+
+          chronologyKind: 'musicVideo',
+        }));
+
+    return language.$(artistsLineCapsule, artistsLineOptions);
+  },
+}