diff options
author | (quasar) nebula <qznebula@protonmail.com> | 2024-05-27 12:40:43 -0300 |
---|---|---|
committer | (quasar) nebula <qznebula@protonmail.com> | 2024-05-30 20:48:19 -0300 |
commit | 42dbfbcbc383c34b2fe4b4c1c193f391438435c8 (patch) | |
tree | 89ad3100560a8e95bfaf1a5b279738655de1745f /src/content/dependencies | |
parent | 9b6bc1c9423dc0e355577b4922458c93114d5d89 (diff) |
content: generateTrackChronologyLinks: nth track art by
See #hsmusic-chat (Lan): https://discord.com/channels/749042497610842152/779895315750715422/1244675456083431576 > I think re: cover art and chronology links on the main album page - I'm > going to leave the album page as it is (always unscoped chronology links). > And change the artwork label when scoped to the album — really it only > means track art, not track+album art.
Diffstat (limited to 'src/content/dependencies')
-rw-r--r-- | src/content/dependencies/generateTrackChronologyLinks.js | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/content/dependencies/generateTrackChronologyLinks.js b/src/content/dependencies/generateTrackChronologyLinks.js index 2849d020..5f6b0771 100644 --- a/src/content/dependencies/generateTrackChronologyLinks.js +++ b/src/content/dependencies/generateTrackChronologyLinks.js @@ -1,5 +1,5 @@ import {sortAlbumsTracksChronologically} from '#sort'; -import {accumulateSum} from '#sugar'; +import {accumulateSum, stitchArrays} from '#sugar'; import getChronologyRelations from '../util/getChronologyRelations.js'; @@ -107,7 +107,7 @@ export default { }, generate(relations) { - function slotScopedRelations(content) { + function slotScopedRelations({content, artworkHeadingString}) { return content.chronologyLinks.slots({ showOnly: true, allowCollapsing: false, @@ -118,7 +118,7 @@ export default { contributions: content.artistChronologyContributions, }, { - headingString: 'misc.chronology.heading.coverArt', + headingString: `misc.chronology.heading.${artworkHeadingString}`, contributions: content.coverArtistChronologyContributions, }, ], @@ -135,6 +135,11 @@ export default { relations.album, ]; + const artworkHeadingStrings = [ + 'coverArt', + 'trackArt', + ]; + const totalContributionCount = Math.max(... contents.map(content => @@ -150,7 +155,10 @@ export default { totalContributionCount <= 5, contents: - contents.map(content => slotScopedRelations(content)) + stitchArrays({ + content: contents, + artworkHeadingString: artworkHeadingStrings, + }).map(slotScopedRelations), }); return relations.scopeSwitcher; |