« get me outta code hell

hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/content/dependencies/generateAlbumInfoPage.js34
-rw-r--r--src/content/dependencies/generateTrackInfoPage.js4
2 files changed, 35 insertions, 3 deletions
diff --git a/src/content/dependencies/generateAlbumInfoPage.js b/src/content/dependencies/generateAlbumInfoPage.js
index 07649a23..3257b139 100644
--- a/src/content/dependencies/generateAlbumInfoPage.js
+++ b/src/content/dependencies/generateAlbumInfoPage.js
@@ -1,3 +1,6 @@
+import getChronologyRelations from '../util/getChronologyRelations.js';
+import {sortAlbumsTracksChronologically} from '../../util/wiki-data.js';
+
 export default {
   contentDependencies: [
     'generateAlbumInfoPageContent',
@@ -5,6 +8,7 @@ export default {
     'generateAlbumSidebar',
     'generateAlbumSocialEmbed',
     'generateAlbumStyleRules',
+    'generateChronologyLinks',
     'generateColorStyleRules',
     'generatePageLayout',
   ],
@@ -14,7 +18,26 @@ export default {
   relations(relation, album) {
     return {
       layout: relation('generatePageLayout'),
+
+      coverArtistChronologyContributions: getChronologyRelations(album, {
+        contributions: album.coverArtistContribs,
+
+        linkArtist: artist => relation('linkArtist', artist),
+
+        linkThing: trackOrAlbum =>
+          (trackOrAlbum.album
+            ? relation('linkTrack', trackOrAlbum)
+            : relation('linkAlbum', trackOrAlbum)),
+
+        getThings: artist =>
+          sortAlbumsTracksChronologically([
+            ...artist.albumsAsCoverArtist,
+            ...artist.tracksAsCoverArtist,
+          ]),
+      }),
+
       albumNavLinks: relation('generateAlbumNavLinks', album, null),
+      chronologyLinks: relation('generateChronologyLinks'),
 
       content: relation('generateAlbumInfoPageContent', album),
       sidebar: relation('generateAlbumSidebar', album, null),
@@ -56,7 +79,16 @@ export default {
               }),
           },
         ],
-        navContent: '(Chronology links here)',
+
+        navContent:
+          relations.chronologyLinks.slots({
+            chronologyInfoSets: [
+              {
+                headingString: 'misc.chronology.heading.coverArt',
+                contributions: relations.coverArtistChronologyContributions,
+              },
+            ],
+          }),
 
         ...relations.sidebar,
 
diff --git a/src/content/dependencies/generateTrackInfoPage.js b/src/content/dependencies/generateTrackInfoPage.js
index 98321d4f..21c15004 100644
--- a/src/content/dependencies/generateTrackInfoPage.js
+++ b/src/content/dependencies/generateTrackInfoPage.js
@@ -7,11 +7,11 @@ export default {
     'generateAlbumNavLinks',
     'generateAlbumSidebar',
     'generateAlbumStyleRules',
+    'generateChronologyLinks',
     'generateColorStyleRules',
     'generatePageLayout',
     'linkAlbum',
     'linkTrack',
-    'generateChronologyLinks',
   ],
 
   extraDependencies: ['language'],
@@ -19,7 +19,6 @@ export default {
   relations(relation, track) {
     return {
       layout: relation('generatePageLayout'),
-      chronologyLinks: relation('generateChronologyLinks'),
 
       artistChronologyContributions: getChronologyRelations(track, {
         contributions: [...track.artistContribs, ...track.contributorContribs],
@@ -54,6 +53,7 @@ export default {
       albumLink: relation('linkAlbum', track.album),
       trackLink: relation('linkTrack', track),
       albumNavLinks: relation('generateAlbumNavLinks', track.album, track),
+      chronologyLinks: relation('generateChronologyLinks'),
 
       content: relation('generateTrackInfoPageContent', track),
       sidebar: relation('generateAlbumSidebar', track.album, track),