From f9e08473fbc0a2f088be3ade780b922ea1b3f22c Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Sun, 29 Dec 2024 21:00:55 -0400 Subject: data, content: showAlbumArtists: all/differing/none This breaks the build. Oop --- .../generateGroupInfoPageAlbumsListBySeries.js | 40 +++++++++++++++------- src/data/validators.js | 3 +- 2 files changed, 30 insertions(+), 13 deletions(-) diff --git a/src/content/dependencies/generateGroupInfoPageAlbumsListBySeries.js b/src/content/dependencies/generateGroupInfoPageAlbumsListBySeries.js index 463522ea..bcd5d288 100644 --- a/src/content/dependencies/generateGroupInfoPageAlbumsListBySeries.js +++ b/src/content/dependencies/generateGroupInfoPageAlbumsListBySeries.js @@ -8,7 +8,13 @@ export default { extraDependencies: ['html', 'language'], - relations: (relation, group) => ({ + query: (group) => ({ + closelyLinkedArtists: + group.closelyLinkedArtists + .map(({artist}) => artist), + }), + + relations: (relation, _query, group) => ({ seriesHeadings: group.serieses .map(() => relation('generateContentHeading')), @@ -22,14 +28,21 @@ export default { group))), }), - data: (group) => ({ + data: (query, group) => ({ seriesNames: group.serieses .map(series => series.name), - seriesShowAlbumArtists: - group.serieses - .map(series => series.showAlbumArtists), + seriesItemsShowArtists: + group.serieses.map(series => + (series.showAlbumArtists === 'all' + ? new Array(series.albums.length).fill(true) + : series.showAlbumArtists === 'differing' + ? series.albums.map(album => + album.artistContribs + .map(contrib => contrib.artist) + .some(artist => !query.closelyLinkedArtists.includes(artist))) + : new Array(series.albums.length).fill(false))), }), generate: (data, relations, {html, language}) => @@ -42,12 +55,12 @@ export default { stitchArrays({ name: data.seriesNames, - showAlbumArtists: data.seriesShowAlbumArtists, + itemsShowArtists: data.seriesItemsShowArtists, heading: relations.seriesHeadings, items: relations.seriesItems, }).map(({ name, - showAlbumArtists, + itemsShowArtists, heading, items, }) => @@ -62,10 +75,13 @@ export default { html.tag('dd', html.tag('ul', - items.map(item => - item.slots({ - accentMode: - (showAlbumArtists ? 'artists' : null), - })))), + stitchArrays({ + item: items, + showArtists: itemsShowArtists, + }).map(({item, showArtists}) => + item.slots({ + accentMode: + (showArtists ? 'artists' : null), + })))), ])))), }; diff --git a/src/data/validators.js b/src/data/validators.js index 94d628c5..a17a98cc 100644 --- a/src/data/validators.js +++ b/src/data/validators.js @@ -718,7 +718,8 @@ export const isSeries = validateProperties({ description: optional(isContentString), albums: optional(validateReferenceList('album')), - showAlbumArtists: optional(isBoolean), + showAlbumArtists: + optional(is('all', 'differing', 'none')), }); export const isSeriesList = validateArrayItems(isSeries); -- cgit 1.3.0-6-gf8a5