diff options
author | (quasar) nebula <qznebula@protonmail.com> | 2024-04-23 16:48:35 -0300 |
---|---|---|
committer | (quasar) nebula <qznebula@protonmail.com> | 2024-05-30 20:48:18 -0300 |
commit | 5b4f7bd906d658116b384122518c43a577141368 (patch) | |
tree | 82136853f3381873b62fdc6a3de5a883c0260d87 /src/content/dependencies/generateScopedTrackChronologyLinks.js | |
parent | 9d655c9a4c910a9dc02eceb850d393832a105fba (diff) |
content: generateTrackChronologyLinks: inline scoping logic
Diffstat (limited to 'src/content/dependencies/generateScopedTrackChronologyLinks.js')
-rw-r--r-- | src/content/dependencies/generateScopedTrackChronologyLinks.js | 89 |
1 files changed, 0 insertions, 89 deletions
diff --git a/src/content/dependencies/generateScopedTrackChronologyLinks.js b/src/content/dependencies/generateScopedTrackChronologyLinks.js deleted file mode 100644 index 87a7c0fd..00000000 --- a/src/content/dependencies/generateScopedTrackChronologyLinks.js +++ /dev/null @@ -1,89 +0,0 @@ -import {sortAlbumsTracksChronologically} from '#sort'; - -import getChronologyRelations from '../util/getChronologyRelations.js'; - -export default { - contentDependencies: [ - 'generateChronologyLinks', - 'linkAlbum', - 'linkArtist', - 'linkTrack', - ], - - relations(relation, album, track) { - const albumFilter = - (album - ? track => track.album === album - : () => true); - - return { - chronologyLinks: - relation('generateChronologyLinks'), - - artistChronologyContributions: - getChronologyRelations(track, { - contributions: [ - ...track.artistContribs ?? [], - ...track.contributorContribs ?? [], - ], - - linkArtist: artist => relation('linkArtist', artist), - linkThing: track => relation('linkTrack', track), - - getThings(artist) { - const getDate = thing => thing.date; - - const things = - ([ - ...artist.tracksAsArtist, - ...artist.tracksAsContributor, - ]).filter(getDate) - .filter(albumFilter); - - return sortAlbumsTracksChronologically(things, {getDate}); - }, - }), - - coverArtistChronologyContributions: - getChronologyRelations(track, { - contributions: track.coverArtistContribs ?? [], - - linkArtist: artist => relation('linkArtist', artist), - - linkThing: trackOrAlbum => - (trackOrAlbum.album - ? relation('linkTrack', trackOrAlbum) - : relation('linkAlbum', trackOrAlbum)), - - getThings(artist) { - const getDate = thing => thing.coverArtDate ?? thing.date; - - const things = - ([ - ...artist.albumsAsCoverArtist, - ...artist.tracksAsCoverArtist, - ]).filter(getDate) - .filter(albumFilter); - - return sortAlbumsTracksChronologically(things, {getDate}); - }, - }), - }; - }, - - generate: (relations) => - relations.chronologyLinks.slots({ - showOnly: true, - - chronologyInfoSets: [ - { - headingString: 'misc.chronology.heading.track', - contributions: relations.artistChronologyContributions, - }, - { - headingString: 'misc.chronology.heading.coverArt', - contributions: relations.coverArtistChronologyContributions, - }, - ], - }), -}; |