From c876fa2573d877f60198b24259d6908a1e775239 Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Tue, 6 Feb 2024 09:56:50 -0400 Subject: content: gAIP{*}ChunkedList: stub processEntries refactor --- .../generateArtistInfoPageCommentaryChunkedList.js | 31 ++++++++++++++-------- 1 file changed, 20 insertions(+), 11 deletions(-) (limited to 'src/content/dependencies/generateArtistInfoPageCommentaryChunkedList.js') 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); -- cgit 1.3.0-6-gf8a5