From 42dbfbcbc383c34b2fe4b4c1c193f391438435c8 Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Mon, 27 May 2024 12:40:43 -0300 Subject: content: generateTrackChronologyLinks: nth track art by MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- src/content/dependencies/generateTrackChronologyLinks.js | 16 ++++++++++++---- src/strings-default.yaml | 1 + 2 files changed, 13 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; diff --git a/src/strings-default.yaml b/src/strings-default.yaml index 0e63201e..7dcbf9c1 100644 --- a/src/strings-default.yaml +++ b/src/strings-default.yaml @@ -490,6 +490,7 @@ misc: coverArt: "{INDEX} cover art by {ARTIST}" flash: "{INDEX} flash/game by {ARTIST}" track: "{INDEX} track by {ARTIST}" + trackArt: "{INDEX} track art by {ARTIST}" onlyIndex: "Only" # external: -- cgit 1.3.0-6-gf8a5