diff options
Diffstat (limited to 'src/content/dependencies')
9 files changed, 160 insertions, 111 deletions
diff --git a/src/content/dependencies/generateArtistInfoPageArtworksChunk.js b/src/content/dependencies/generateArtistInfoPageArtworksChunk.js index f4c9439a..eb15d54b 100644 --- a/src/content/dependencies/generateArtistInfoPageArtworksChunk.js +++ b/src/content/dependencies/generateArtistInfoPageArtworksChunk.js @@ -25,18 +25,19 @@ export default { }, }, - generate: (data, relations, slots) => + generate: (data, relations, slots, {html}) => relations.template.slots({ mode: 'album', - albumLink: relations.albumLink, + link: relations.albumLink, dates: (slots.filterEditsForWiki ? Array.from({length: data.dates}, () => null) : data.dates), - items: - relations.items.map(item => - item.slot('filterEditsForWiki', slots.filterEditsForWiki)), + list: + html.tag('ul', + relations.items.map(item => + item.slot('filterEditsForWiki', slots.filterEditsForWiki))), }), }; diff --git a/src/content/dependencies/generateArtistInfoPageChunk.js b/src/content/dependencies/generateArtistInfoPageChunk.js index 80429912..3fa46c61 100644 --- a/src/content/dependencies/generateArtistInfoPageChunk.js +++ b/src/content/dependencies/generateArtistInfoPageChunk.js @@ -8,17 +8,12 @@ export default { id: {type: 'string'}, - albumLink: { + link: { type: 'html', mutable: false, }, - flashActLink: { - type: 'html', - mutable: false, - }, - - items: { + list: { type: 'html', mutable: false, }, @@ -51,50 +46,43 @@ export default { } let accentedLink; - - accent: { - switch (slots.mode) { - case 'album': { - accentedLink = slots.albumLink; - - const options = {album: accentedLink}; - const parts = ['artistPage.creditList.album']; - - if (onlyDate) { - parts.push('withDate'); - options.date = language.formatDate(onlyDate); - } - - if (slots.duration) { - parts.push('withDuration'); - options.duration = - language.formatDuration(slots.duration, { - approximate: slots.durationApproximate, - }); - } - - accentedLink = language.formatString(...parts, options); - break; + switch (slots.mode) { + case 'album': { + const options = {album: slots.link}; + const parts = ['artistPage.creditList.album']; + + if (onlyDate) { + parts.push('withDate'); + options.date = language.formatDate(onlyDate); } - case 'flash': { - accentedLink = slots.flashActLink; - - const options = {act: accentedLink}; - const parts = ['artistPage.creditList.flashAct']; + if (slots.duration) { + parts.push('withDuration'); + options.duration = + language.formatDuration(slots.duration, { + approximate: slots.durationApproximate, + }); + } - if (onlyDate) { - parts.push('withDate'); - options.date = language.formatDate(onlyDate); - } else if (earliestDate && latestDate) { - parts.push('withDateRange'); - options.dateRange = - language.formatDateRange(earliestDate, latestDate); - } + accentedLink = language.formatString(...parts, options); + break; + } - accentedLink = language.formatString(...parts, options); - break; + case 'flash': { + const options = {act: slots.link}; + const parts = ['artistPage.creditList.flashAct']; + + if (onlyDate) { + parts.push('withDate'); + options.date = language.formatDate(onlyDate); + } else if (earliestDate && latestDate) { + parts.push('withDateRange'); + options.dateRange = + language.formatDateRange(earliestDate, latestDate); } + + accentedLink = language.formatString(...parts, options); + break; } } @@ -103,10 +91,7 @@ export default { slots.id && {id: slots.id}, accentedLink), - html.tag('dd', - html.tag('ul', - {class: 'offset-tooltips'}, - slots.items)), + html.tag('dd', slots.list), ]); }, }; diff --git a/src/content/dependencies/generateArtistInfoPageCommentaryChunkedList.js b/src/content/dependencies/generateArtistInfoPageCommentaryChunkedList.js index caec58d6..08446a2e 100644 --- a/src/content/dependencies/generateArtistInfoPageCommentaryChunkedList.js +++ b/src/content/dependencies/generateArtistInfoPageCommentaryChunkedList.js @@ -220,52 +220,57 @@ export default { (chunkType === 'album' ? chunk.slots({ mode: 'album', - albumLink: chunkLink, - items: - stitchArrays({ - item: items, - link: itemLinks, - annotation: itemAnnotations, - type: itemTypes, - }).map(({item, link, annotation, type}) => - item.slots({ - annotation: - annotation.slots({ - mode: 'inline', - absorbPunctuationFollowingExternalLinks: false, - }), - - content: - (type === 'album' - ? html.tag('i', - language.$(capsule, 'album.commentary')) - : language.$(capsule, 'track', {track: link})), - })), + link: chunkLink, + + list: + html.tag('ul', + stitchArrays({ + item: items, + link: itemLinks, + annotation: itemAnnotations, + type: itemTypes, + }).map(({item, link, annotation, type}) => + item.slots({ + annotation: + annotation.slots({ + mode: 'inline', + absorbPunctuationFollowingExternalLinks: false, + }), + + content: + (type === 'album' + ? html.tag('i', + language.$(capsule, 'album.commentary')) + : language.$(capsule, 'track', {track: link})), + }))), }) - : chunkType === 'flash-act' + + : chunkType === 'flash-act' ? chunk.slots({ mode: 'flash', - flashActLink: chunkLink, - items: - stitchArrays({ - item: items, - link: itemLinks, - annotation: itemAnnotations, - }).map(({item, link, annotation}) => - item.slots({ - annotation: - (annotation - ? annotation.slots({ - mode: 'inline', - absorbPunctuationFollowingExternalLinks: false, - }) - : null), - - content: - language.$(capsule, 'flash', { - flash: link, - }), - })), + link: chunkLink, + + list: + html.tag('ul', + stitchArrays({ + item: items, + link: itemLinks, + annotation: itemAnnotations, + }).map(({item, link, annotation}) => + item.slots({ + annotation: + (annotation + ? annotation.slots({ + mode: 'inline', + absorbPunctuationFollowingExternalLinks: false, + }) + : null), + + content: + language.$(capsule, 'flash', { + flash: link, + }), + }))), }) : null)))), }; diff --git a/src/content/dependencies/generateArtistInfoPageFlashesChunk.js b/src/content/dependencies/generateArtistInfoPageFlashesChunk.js index acdb9897..ce89d80c 100644 --- a/src/content/dependencies/generateArtistInfoPageFlashesChunk.js +++ b/src/content/dependencies/generateArtistInfoPageFlashesChunk.js @@ -18,11 +18,13 @@ export default { .map(contrib => contrib.date), }), - generate: (data, relations) => + generate: (data, relations, {html}) => relations.template.slots({ mode: 'flash', - flashActLink: relations.flashActLink, + link: relations.flashActLink, dates: data.dates, - items: relations.items, + + list: + html.tag('ul', relations.items), }), }; diff --git a/src/content/dependencies/generateArtistInfoPageTracksChunk.js b/src/content/dependencies/generateArtistInfoPageTracksChunk.js index 3e4cc4e9..7d00fdd6 100644 --- a/src/content/dependencies/generateArtistInfoPageTracksChunk.js +++ b/src/content/dependencies/generateArtistInfoPageTracksChunk.js @@ -1,4 +1,5 @@ -import {unique} from '#sugar'; +import {sortAlbumsTracksChronologically} from '#sort'; +import {empty, unique} from '#sugar'; import {getTotalDuration} from '#wiki-data'; export default { @@ -18,7 +19,7 @@ export default { trackContribs)), }), - data(_artist, album, trackContribLists) { + data(artist, album, trackContribLists) { const data = {}; const contribs = @@ -43,19 +44,47 @@ export default { data.durationApproximate = durationTerms.length > 1; + const tracks = + trackContribLists.map(contribs => contribs[0].thing); + + data.numLinkingOtherReleases = + tracks.filter(track => { + if (empty(track.otherReleases)) return false; + + const releases = + sortAlbumsTracksChronologically(track.allReleases.slice()); + + // later releases always link to first release + if (track !== releases[0]) return true; + + // first releases only link to later credited releases + return tracks.slice(1).some(track => { + const contribs = [ + ...track.artistContribs, + ...track.contributorContribs, + ]; + + return contribs.some(contrib => contrib.artist === artist); + }); + }).length; + return data; }, - generate: (data, relations) => + generate: (data, relations, {html}) => relations.template.slots({ mode: 'album', - - albumLink: relations.albumLink, + link: relations.albumLink, dates: data.dates, duration: data.duration, durationApproximate: data.durationApproximate, - items: relations.items, + list: + html.tag('ul', + data.numLinkingOtherReleases > 1 && + {class: 'offset-tooltips'}, + + relations.items), }), }; diff --git a/src/content/dependencies/generateContributionList.js b/src/content/dependencies/generateContributionList.js index 3716bcd6..4f68321f 100644 --- a/src/content/dependencies/generateContributionList.js +++ b/src/content/dependencies/generateContributionList.js @@ -9,10 +9,14 @@ export default { chronologyKind: {type: 'string'}, }, - generate: (relations, slots, {html}) => + generate: (relations, slots, {html, language}) => html.tag('ul', {[html.onlyIfContent]: true}, + relations.contributionLinks.length > 1 && + language.$order('misc.artistLink.withContribution', 0) === 'ARTIST' && + {class: 'offset-tooltips'}, + relations.contributionLinks .map(contributionLink => html.tag('li', diff --git a/src/content/dependencies/generateGroupInfoPageAlbumsListByDate.js b/src/content/dependencies/generateGroupInfoPageAlbumsListByDate.js index de55f33a..bd3f5dd5 100644 --- a/src/content/dependencies/generateGroupInfoPageAlbumsListByDate.js +++ b/src/content/dependencies/generateGroupInfoPageAlbumsListByDate.js @@ -29,12 +29,16 @@ export default { }, }, - generate: (relations, slots, {html}) => + generate: (relations, slots, {html, language}) => html.tag('ul', {id: 'group-album-list-by-date'}, slots.hidden && {style: 'display: none'}, + relations.items.length > 1&& + language.$order('groupInfoPage.albumList.item.withYear', 0) === 'YEAR_ACCENT' && + {class: 'offset-tooltips'}, + {[html.onlyIfContent]: true}, relations.items diff --git a/src/content/dependencies/generateGroupInfoPageAlbumsListBySeries.js b/src/content/dependencies/generateGroupInfoPageAlbumsListBySeries.js index f8314d71..ddba0aec 100644 --- a/src/content/dependencies/generateGroupInfoPageAlbumsListBySeries.js +++ b/src/content/dependencies/generateGroupInfoPageAlbumsListBySeries.js @@ -12,6 +12,10 @@ export default { group.serieses .map(() => relation('generateContentHeading')), + seriesDescriptions: + group.serieses + .map(series => relation('transformContent', series.description)), + seriesItems: group.serieses .map(series => series.albums @@ -44,17 +48,23 @@ export default { {id: 'group-album-list-by-series'}, {class: 'group-series-list'}, + relations.seriesItems.flat().length > 1 && + language.$order(listCapsule, 'item.withYear', 0) === 'YEAR_ACCENT' && + {class: 'offset-tooltips'}, + {[html.onlyIfContent]: true}, stitchArrays({ name: data.seriesNames, itemsShowArtists: data.seriesItemsShowArtists, heading: relations.seriesHeadings, + description: relations.seriesDescriptions, items: relations.seriesItems, }).map(({ name, itemsShowArtists, heading, + description, items, }) => html.tags([ @@ -66,7 +76,11 @@ export default { }), }), - html.tag('dd', + html.tag('dd', [ + html.tag('blockquote', + {[html.onlyIfContent]: true}, + description), + html.tag('ul', stitchArrays({ item: items, @@ -75,6 +89,7 @@ export default { item.slots({ accentMode: (showArtists ? 'artists' : null), - })))), + }))), + ]), ])))), }; diff --git a/src/content/dependencies/generateNewsEntryReadAnotherLinks.js b/src/content/dependencies/generateNewsEntryReadAnotherLinks.js index 1f6ee6d4..50c23513 100644 --- a/src/content/dependencies/generateNewsEntryReadAnotherLinks.js +++ b/src/content/dependencies/generateNewsEntryReadAnotherLinks.js @@ -70,12 +70,16 @@ export default { entryLines.push(language.$(...parts, options)); } + console.log(language.$order(prefix, 'previous.withDate', 0)); + return ( html.tag('p', {class: 'read-another-links'}, {[html.onlyIfContent]: true}, {[html.joinChildren]: html.tag('br')}, entryLines.length > 1 && + language.$order(prefix, 'previous.withDate', 0) === 'DATE' && + language.$order(prefix, 'next.withDate', 0) === 'DATE' && {class: 'offset-tooltips'}, entryLines)); |