diff options
author | (quasar) nebula <qznebula@protonmail.com> | 2023-04-12 13:20:32 -0300 |
---|---|---|
committer | (quasar) nebula <qznebula@protonmail.com> | 2023-04-12 13:20:32 -0300 |
commit | 3a5b49cf3a10702c0dae1190c9baabd8a2c2ef3b (patch) | |
tree | c7a1ac0d4c2096733fd3fdfdc549f5695a78532e /src/content/dependencies/generateContributionLinks.js | |
parent | b8394a89d31da72ef7d2086a1088a29e68df4edc (diff) |
content: stub track page, misc. other changes
* generateContributionLinks replaced with linkContribution, tests still need updating * album pages respect albums without cover art * track pages without unique art inherit art tags from album (fixes #13) not heavily tested, this commit probably breaks some pages which were loading correctly before
Diffstat (limited to 'src/content/dependencies/generateContributionLinks.js')
-rw-r--r-- | src/content/dependencies/generateContributionLinks.js | 87 |
1 files changed, 0 insertions, 87 deletions
diff --git a/src/content/dependencies/generateContributionLinks.js b/src/content/dependencies/generateContributionLinks.js deleted file mode 100644 index c035c271..00000000 --- a/src/content/dependencies/generateContributionLinks.js +++ /dev/null @@ -1,87 +0,0 @@ -import {empty} from '../../util/sugar.js'; - -export default { - contentDependencies: [ - 'linkArtist', - 'linkExternalAsIcon', - ], - - extraDependencies: [ - 'html', - 'language', - ], - - relations(relation, contributions, {showIcons = false} = {}) { - const relations = {}; - - relations.artistLinks = - contributions.map(({who}) => relation('linkArtist', who)); - - if (showIcons) { - relations.artistIcons = - contributions.map(({who}) => - who.urls.map(url => - relation('linkExternalAsIcon', url))); - } - - return relations; - }, - - data(contributions, { - showContribution = false, - showIcons = false, - } = {}) { - const data = {}; - - data.contributionData = - contributions.map(({who, what}) => ({ - hasContributionPart: !!(showContribution && what), - hasExternalPart: !!(showIcons && !empty(who.urls)), - contribution: showContribution && what, - })); - - return data; - }, - - generate(data, relations, { - html, - language, - }) { - return language.formatConjunctionList( - data.contributionData.map(({ - hasContributionPart, - hasExternalPart, - contribution, - }, index) => { - const artistLink = relations.artistLinks[index]; - const artistIcons = relations.artistIcons?.[index]; - - const externalLinks = hasExternalPart && - html.tag('span', - {[html.noEdgeWhitespace]: true, class: 'icons'}, - language.formatUnitList(artistIcons)); - - return ( - (hasContributionPart - ? (hasExternalPart - ? language.$('misc.artistLink.withContribution.withExternalLinks', { - artist: artistLink, - contrib: contribution, - links: externalLinks, - }) - : language.$('misc.artistLink.withContribution', { - artist: artistLink, - contrib: contribution, - })) - : (hasExternalPart - ? language.$('misc.artistLink.withExternalLinks', { - artist: artistLink, - links: externalLinks, - }) - : language.$('misc.artistLink', { - artist: artistLink, - }))) - ); - })); - }, -}; |