« get me outta code hell

hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/content/dependencies/generateMusicVideo.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/content/dependencies/generateMusicVideo.js')
-rw-r--r--src/content/dependencies/generateMusicVideo.js44
1 files changed, 18 insertions, 26 deletions
diff --git a/src/content/dependencies/generateMusicVideo.js b/src/content/dependencies/generateMusicVideo.js
index a61cd5b7..e83fdf80 100644
--- a/src/content/dependencies/generateMusicVideo.js
+++ b/src/content/dependencies/generateMusicVideo.js
@@ -1,5 +1,5 @@
 export default {
-  relations: (relation, musicVideo) => ({
+  relations: (relation, musicVideo, thing) => ({
     image:
       relation('image', {
         path: musicVideo.path,
@@ -7,14 +7,14 @@ export default {
         dimensions: musicVideo.coverArtDimensions,
       }),
 
-    artistCredit:
-      relation('generateArtistCredit', musicVideo.artistContribs, []),
+    releaseLine:
+      relation('generateMusicVideoReleaseLine', musicVideo, thing),
 
     contributorCredit:
       relation('generateArtistCredit', musicVideo.contributorContribs, []),
   }),
 
-  data: (musicVideo) => ({
+  data: (musicVideo, _track) => ({
     label:
       musicVideo.label,
 
@@ -45,33 +45,25 @@ export default {
           {[html.joinChildren]: html.tag('br')},
 
           [
-            language.encapsulate(capsule, 'by', workingCapsule => {
-              const additionalStringOptions = {};
+            html.tag('span', {class: 'release-line'},
+              {[html.onlyIfContent]: true},
 
-              if (data.label) {
-                workingCapsule += '.customLabel';
-                additionalStringOptions.label = data.label;
-              }
+              relations.releaseLine),
 
-              return relations.artistCredit.slots({
-                normalStringKey: workingCapsule,
-                additionalStringOptions,
+            language.encapsulate(capsule, 'contributorsLine', capsule =>
+              language.$(capsule, {
+                [language.onlyIfOptions]: ['credit'],
 
-                showAnnotation: true,
-                showChronology: true,
+                credit:
+                  relations.contributorCredit.slots({
+                    normalStringKey: language.encapsulate(capsule, 'credit'),
 
-                chronologyKind: 'musicVideo',
-              });
-            }),
+                    showAnnotation: true,
+                    showChronology: true,
 
-            relations.contributorCredit.slots({
-              normalStringKey: language.encapsulate(capsule, 'contributors'),
-
-              showAnnotation: true,
-              showChronology: true,
-
-              chronologyKind: 'musicVideoContribution',
-            }),
+                    chronologyKind: 'musicVideoContribution',
+                  }),
+              })),
           ]),
       ])),
 };