« get me outta code hell

content: generateArtistInfoPage: artist avatar - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2023-06-04 13:29:05 -0300
committer(quasar) nebula <qznebula@protonmail.com>2023-06-04 13:29:05 -0300
commitd26289b526610f19cbb6c763b28d0c45c9648a85 (patch)
treee3139de1f5a2183bb0de5b6f4d4f7a4923ceb24c /src
parentefb328474f6bc004d7fdfc2473e773f87ba3cbb1 (diff)
content: generateArtistInfoPage: artist avatar
Diffstat (limited to 'src')
-rw-r--r--src/content/dependencies/generateArtistInfoPage.js22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/content/dependencies/generateArtistInfoPage.js b/src/content/dependencies/generateArtistInfoPage.js
index 8d5077b9..71f1001d 100644
--- a/src/content/dependencies/generateArtistInfoPage.js
+++ b/src/content/dependencies/generateArtistInfoPage.js
@@ -11,6 +11,7 @@ export default {
   contentDependencies: [
     'generateArtistNavLinks',
     'generateContentHeading',
+    'generateCoverArtwork',
     'generatePageLayout',
     'linkAlbum',
     'linkArtist',
@@ -122,6 +123,11 @@ export default {
       return groupInfo;
     }
 
+    if (artist.hasAvatar) {
+      relations.cover =
+        relation('generateCoverArtwork', []);
+    }
+
     if (artist.contextNotes) {
       const contextNotes = sections.contextNotes = {};
       contextNotes.content = relation('transformContent', artist.contextNotes);
@@ -360,6 +366,11 @@ export default {
     const data = {};
 
     data.name = artist.name;
+    data.directory = artist.directory;
+
+    if (artist.hasAvatar) {
+      data.avatarFileExtension = artist.avatarFileExtension;
+    }
 
     const allTracks = unique([...artist.tracksAsArtist, ...artist.tracksAsContributor]);
     data.totalTrackCount = allTracks.length;
@@ -430,6 +441,17 @@ export default {
         title: data.name,
         headingMode: 'sticky',
 
+        cover:
+          (relations.cover
+            ? relations.cover.slots({
+                path: [
+                  'media.artistAvatar',
+                  data.directory,
+                  data.avatarFileExtension,
+                ],
+              })
+            : null),
+
         mainClasses: ['long-content'],
         mainContent: [
           sec.contextNotes && [