diff options
-rw-r--r-- | src/content/dependencies/generateArtistInfoPage.js | 26 | ||||
-rw-r--r-- | src/content/dependencies/generateArtistInfoPageArtworksChunkedList.js | 33 | ||||
-rw-r--r-- | src/strings-default.yaml | 3 |
3 files changed, 51 insertions, 11 deletions
diff --git a/src/content/dependencies/generateArtistInfoPage.js b/src/content/dependencies/generateArtistInfoPage.js index f9ce7e3b..f2fdc5b6 100644 --- a/src/content/dependencies/generateArtistInfoPage.js +++ b/src/content/dependencies/generateArtistInfoPage.js @@ -40,6 +40,7 @@ export default { artist.albumBannerArtistContributions, artist.trackCoverArtistContributions, ]).flat() + .filter(({annotation}) => !annotation?.startsWith('edits for wiki')) .map(({thing}) => thing), // Banners and wallpapers don't show up in the artist gallery page, only @@ -78,7 +79,10 @@ export default { relation('generateArtistGroupContributionsInfo', query.allTracks), artworksChunkedList: - relation('generateArtistInfoPageArtworksChunkedList', artist), + relation('generateArtistInfoPageArtworksChunkedList', artist, false), + + editsForWikiArtworksChunkedList: + relation('generateArtistInfoPageArtworksChunkedList', artist, true), artworksGroupInfo: relation('generateArtistGroupContributionsInfo', query.allArtworks), @@ -181,10 +185,11 @@ export default { {href: '#tracks'}, language.$(pageCapsule, 'trackList.title')), - !html.isBlank(relations.artworksChunkedList) && - html.tag('a', - {href: '#art'}, - language.$(pageCapsule, 'artList.title')), + (!html.isBlank(relations.artworksChunkedList) || + !html.isBlank(relations.editsForWikiArtworksChunkedList)) && + html.tag('a', + {href: '#art'}, + language.$(pageCapsule, 'artList.title')), !html.isBlank(relations.flashesChunkedList) && html.tag('a', @@ -276,6 +281,17 @@ export default { countUnit: 'artworks', })), }), + + html.tags([ + html.tag('p', + {[html.onlyIfSiblings]: true}, + + language.$(pageCapsule, 'wikiEditArtworks', { + artist: data.name, + })), + + relations.editsForWikiArtworksChunkedList, + ]), ]), html.tags([ diff --git a/src/content/dependencies/generateArtistInfoPageArtworksChunkedList.js b/src/content/dependencies/generateArtistInfoPageArtworksChunkedList.js index caefb7a3..2be02577 100644 --- a/src/content/dependencies/generateArtistInfoPageArtworksChunkedList.js +++ b/src/content/dependencies/generateArtistInfoPageArtworksChunkedList.js @@ -8,7 +8,7 @@ export default { 'generateArtistInfoPageArtworksChunk', ], - query(artist) { + query(artist, filterEditsForWiki) { const query = {}; const allContributions = [ @@ -18,12 +18,19 @@ export default { ...artist.trackCoverArtistContributions, ]; + const filteredContributions = + allContributions + .filter(({annotation}) => + (filterEditsForWiki + ? annotation?.startsWith(`edits for wiki`) + : !annotation?.startsWith(`edits for wiki`))); + sortContributionsChronologically( - allContributions, + filteredContributions, sortAlbumsTracksChronologically); query.contribs = - chunkByConditions(allContributions, [ + chunkByConditions(filteredContributions, [ ({date: date1}, {date: date2}) => +date1 !== +date2, ({thing: thing1}, {thing: thing2}) => @@ -39,7 +46,7 @@ export default { return query; }, - relations: (relation, query, _artist) => ({ + relations: (relation, query, _artist, _filterEditsForWiki) => ({ chunkedList: relation('generateArtistInfoPageChunkedList'), @@ -51,8 +58,22 @@ export default { relation('generateArtistInfoPageArtworksChunk', album, contribs)), }), - generate: (relations) => + data: (_query, _artist, filterEditsForWiki) => ({ + filterEditsForWiki, + }), + + generate: (data, relations) => relations.chunkedList.slots({ - chunks: relations.chunks, + chunks: + relations.chunks.map(chunk => { + if (data.filterEditsForWiki) { + chunk.setSlots({ + trimAnnotations: true, + dates: [], + }); + } + + return chunk; + }), }), }; diff --git a/src/strings-default.yaml b/src/strings-default.yaml index 0dc86ef0..dd72e1d9 100644 --- a/src/strings-default.yaml +++ b/src/strings-default.yaml @@ -1153,6 +1153,9 @@ artistPage: orBrowseList: "View {LINK}! Or browse the list:" link: "art gallery" + wikiEditArtworks: >- + {ARTIST} has edited these artworks for this wiki: + # # artistGalleryPage: # The artist gallery page shows a neat grid of all of the album and |