From 3a5b49cf3a10702c0dae1190c9baabd8a2c2ef3b Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Wed, 12 Apr 2023 13:20:32 -0300 Subject: 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 --- .../dependencies/generateContributionLinks.js | 87 ---------------------- 1 file changed, 87 deletions(-) delete mode 100644 src/content/dependencies/generateContributionLinks.js (limited to 'src/content/dependencies/generateContributionLinks.js') 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, - }))) - ); - })); - }, -}; -- cgit 1.3.0-6-gf8a5