diff options
Diffstat (limited to 'src/content/dependencies/generateArtistInfoPageCommentaryChunkedList.js')
-rw-r--r-- | src/content/dependencies/generateArtistInfoPageCommentaryChunkedList.js | 31 |
1 files changed, 20 insertions, 11 deletions
diff --git a/src/content/dependencies/generateArtistInfoPageCommentaryChunkedList.js b/src/content/dependencies/generateArtistInfoPageCommentaryChunkedList.js index af5a923f..2892152e 100644 --- a/src/content/dependencies/generateArtistInfoPageCommentaryChunkedList.js +++ b/src/content/dependencies/generateArtistInfoPageCommentaryChunkedList.js @@ -18,23 +18,32 @@ export default { extraDependencies: ['html', 'language'], query(artist) { - const entries = [ - ...artist.albumsAsCommentator.map(album => ({ - thing: album, - entry: { + const processEntries = (things, details) => + things.map(thing => ({ + thing, + entry: details(thing), + })); + + const albumEntries = + processEntries( + artist.albumsAsCommentator, + album => ({ type: 'album', album, - }, - })), + })); - ...artist.tracksAsCommentator.map(track => ({ - thing: track, - entry: { + const trackEntries = + processEntries( + artist.tracksAsCommentator, + track => ({ type: 'track', album: track.album, track, - }, - })), + })); + + const entries = [ + ...albumEntries, + ...trackEntries, ]; sortEntryThingPairs(entries, sortAlbumsTracksChronologically); |