From 84757d1e54f9cb8825b041368b55e01ba0d4b17b Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Thu, 10 Aug 2023 10:54:41 -0300 Subject: content: generateContributionList --- src/content/dependencies/generateContributionList.js | 20 ++++++++++++++++++++ src/content/dependencies/generateTrackInfoPage.js | 16 ++++------------ 2 files changed, 24 insertions(+), 12 deletions(-) create mode 100644 src/content/dependencies/generateContributionList.js diff --git a/src/content/dependencies/generateContributionList.js b/src/content/dependencies/generateContributionList.js new file mode 100644 index 00000000..731cfba5 --- /dev/null +++ b/src/content/dependencies/generateContributionList.js @@ -0,0 +1,20 @@ +export default { + contentDependencies: ['linkContribution'], + extraDependencies: ['html'], + + relations: (relation, contributions) => + ({contributionLinks: + contributions + .map(contrib => relation('linkContribution', contrib))}), + + generate: (relations, {html}) => + html.tag('ul', + relations.contributionLinks.map(contributionLink => + html.tag('li', + contributionLink + .slots({ + showIcons: true, + showContribution: true, + preventWrapping: false, + })))), +}; diff --git a/src/content/dependencies/generateTrackInfoPage.js b/src/content/dependencies/generateTrackInfoPage.js index e02a2e3b..742f3902 100644 --- a/src/content/dependencies/generateTrackInfoPage.js +++ b/src/content/dependencies/generateTrackInfoPage.js @@ -16,6 +16,7 @@ export default { 'generateAlbumStyleRules', 'generateChronologyLinks', 'generateContentHeading', + 'generateContributionList', 'generatePageLayout', 'generateTrackCoverArtwork', 'generateTrackList', @@ -24,7 +25,6 @@ export default { 'generateTrackSocialEmbed', 'linkAlbum', 'linkArtist', - 'linkContribution', 'linkFlash', 'linkTrack', 'transformContent', @@ -149,9 +149,8 @@ export default { contributors.heading = relation('generateContentHeading'); - contributors.contributionLinks = - track.contributorContribs - .map(contrib => relation('linkContribution', contrib)); + contributors.list = + relation('generateContributionList', track.contributorContribs); } // Section: Referenced tracks @@ -369,14 +368,7 @@ export default { title: language.$('releaseInfo.contributors'), }), - html.tag('ul', - sec.contributors.contributionLinks.map(contributionLink => - html.tag('li', - contributionLink - .slots({ - showIcons: true, - showContribution: true, - })))), + sec.contributors.list, ], sec.references && [ -- cgit 1.3.0-6-gf8a5