diff options
author | (quasar) nebula <qznebula@protonmail.com> | 2024-04-10 20:42:06 -0300 |
---|---|---|
committer | (quasar) nebula <qznebula@protonmail.com> | 2024-06-18 22:56:06 -0300 |
commit | aba51f9096e656c0f6efc5efceea150b6c960bda (patch) | |
tree | 3c2912cc383b6a5f8fed68bf1da5c79f5fc8f658 /src/content/dependencies/generateArtistInfoPageArtworksChunk.js | |
parent | 53eda2cb50292420f115adb2d32627dcca8e19df (diff) |
content: gAIPArtworksChunkedList: general refactor a la tracks
Diffstat (limited to 'src/content/dependencies/generateArtistInfoPageArtworksChunk.js')
-rw-r--r-- | src/content/dependencies/generateArtistInfoPageArtworksChunk.js | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/src/content/dependencies/generateArtistInfoPageArtworksChunk.js b/src/content/dependencies/generateArtistInfoPageArtworksChunk.js new file mode 100644 index 00000000..b62cb39b --- /dev/null +++ b/src/content/dependencies/generateArtistInfoPageArtworksChunk.js @@ -0,0 +1,38 @@ +export default { + contentDependencies: [ + 'generateArtistInfoPageChunk', + 'generateArtistInfoPageArtworksChunkItem', + 'linkAlbum', + ], + + relations: (relation, album, contribs) => ({ + template: + relation('generateArtistInfoPageChunk'), + + albumLink: + relation('linkAlbum', album), + + // Intentional mapping here: each item may be associated with + // more than one contribution. (Note: this is only currently + // applicable for track contributions, but we're retaining the + // structure in other contributions too.) + items: + contribs + .map(contrib => + relation('generateArtistInfoPageArtworksChunkItem', contrib)), + }), + + data: (_album, contribs) => ({ + dates: + contribs + .map(contrib => contrib.date), + }), + + generate: (data, relations) => + relations.template.slots({ + mode: 'album', + albumLink: relations.albumLink, + dates: data.dates, + items: relations.items, + }), +}; |