diff options
Diffstat (limited to 'src/content/dependencies/generateMusicVideoArtistsLine.js')
| -rw-r--r-- | src/content/dependencies/generateMusicVideoArtistsLine.js | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/src/content/dependencies/generateMusicVideoArtistsLine.js b/src/content/dependencies/generateMusicVideoArtistsLine.js new file mode 100644 index 00000000..b1baac31 --- /dev/null +++ b/src/content/dependencies/generateMusicVideoArtistsLine.js @@ -0,0 +1,53 @@ +export default { + relations: (relation, musicVideo) => ({ + artistCredit: + relation('generateArtistCredit', musicVideo.artistContribs, []), + }), + + data: (musicVideo) => ({ + label: + musicVideo.label, + }), + + generate: (data, relations, {html, language}) => + language.encapsulate('misc.musicVideo.artistsLine', artistsLineCapsule => + language.encapsulate(artistsLineCapsule, workingCapsule => { + const credit = relations.artistCredit; + + credit.setSlots({ + normalStringKey: + language.encapsulate(artistsLineCapsule, 'credit'), + + showAnnotation: true, + showChronology: true, + showExternalLinks: true, + + chronologyKind: 'musicVideo', + }); + + if (html.isBlank(credit)) { + return html.blank(); + } + + if (data.label === 'Music video' || !data.label) { + credit.setSlots({ + normalStringKey: + language.encapsulate(artistsLineCapsule, 'noLabel'), + }); + + return credit; + } + + const workingOptions = {}; + + workingOptions.credit = + html.tag('span', {class: 'by'}, credit); + + if (data.label && data.label !== 'Music video') { + workingCapsule += '.customLabel'; + workingOptions.label = data.label; + } + + return language.$(workingCapsule, workingOptions); + })), +}; |