diff options
Diffstat (limited to 'src/content')
-rw-r--r-- | src/content/dependencies/generateChronologyLinks.js | 3 | ||||
-rw-r--r-- | src/content/dependencies/generateTrackChronologyLinks.js | 36 | ||||
-rw-r--r-- | src/content/util/getChronologyRelations.js | 4 |
3 files changed, 33 insertions, 10 deletions
diff --git a/src/content/dependencies/generateChronologyLinks.js b/src/content/dependencies/generateChronologyLinks.js index b769a5aa..7f24ded7 100644 --- a/src/content/dependencies/generateChronologyLinks.js +++ b/src/content/dependencies/generateChronologyLinks.js @@ -21,10 +21,11 @@ export default { headingString: v.isString, contributions: v.strictArrayOf(v.validateProperties({ index: v.isCountingNumber, + only: v.isBoolean, + artistDirectory: v.isDirectory, artistLink: v.isHTML, previousLink: v.isHTML, nextLink: v.isHTML, - only: v.isBoolean, })), })), } diff --git a/src/content/dependencies/generateTrackChronologyLinks.js b/src/content/dependencies/generateTrackChronologyLinks.js index 15c2cae9..24e56698 100644 --- a/src/content/dependencies/generateTrackChronologyLinks.js +++ b/src/content/dependencies/generateTrackChronologyLinks.js @@ -74,16 +74,36 @@ export default { }; } - return { - scopeSwitcher: - relation('generateChronologyLinksScopeSwitcher'), + const relations = {}; - wiki: - getScopedRelations(null), + relations.scopeSwitcher = + relation('generateChronologyLinksScopeSwitcher'); - album: - getScopedRelations(track.album), - }; + relations.wiki = + getScopedRelations(null); + + relations.album = + getScopedRelations(track.album); + + for (const setKey of [ + 'artistChronologyContributions', + 'coverArtistChronologyContributions', + ]) { + const wikiSet = relations.wiki[setKey]; + const albumSet = relations.album[setKey]; + + const wikiArtistDirectories = + wikiSet + .map(({artistDirectory}) => artistDirectory); + + albumSet.sort((a, b) => + (a.index === b.index + ? (wikiArtistDirectories.indexOf(a.artistDirectory) + - wikiArtistDirectories.indexOf(b.artistDirectory)) + : 0)); + } + + return relations; }, generate(relations) { diff --git a/src/content/util/getChronologyRelations.js b/src/content/util/getChronologyRelations.js index e4475ff8..c601a990 100644 --- a/src/content/util/getChronologyRelations.js +++ b/src/content/util/getChronologyRelations.js @@ -42,10 +42,12 @@ export default function getChronologyRelations(thing, { return { index: index + 1, + artistDirectory: artist.directory, + only: !(previous || next), + artistLink: linkArtist(artist), previousLink: previous ? linkThing(previous) : null, nextLink: next ? linkThing(next) : null, - only: !(previous || next), }; }).filter(Boolean) .sort((a, b) => |