« get me outta code hell

content: generateArtistInfoPageRereleaseTooltip, etc (wip) - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/content/dependencies/generateArtistInfoPageChunkItem.js
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2025-02-20 00:35:30 -0400
committer(quasar) nebula <qznebula@protonmail.com>2025-03-02 08:24:13 -0400
commit5580640828d71d3c17f1c1f3ac51b42a9082d663 (patch)
tree4a27b7ef44107799d81ff31c28736234e8c21e27 /src/content/dependencies/generateArtistInfoPageChunkItem.js
parentb9164020ecf0a8a136c7e45c4c23fe38fc29cd98 (diff)
content: generateArtistInfoPageRereleaseTooltip, etc (wip)
Missing tooltip for first release + link hash target
so this is very much still wip
Diffstat (limited to 'src/content/dependencies/generateArtistInfoPageChunkItem.js')
-rw-r--r--src/content/dependencies/generateArtistInfoPageChunkItem.js22
1 files changed, 19 insertions, 3 deletions
diff --git a/src/content/dependencies/generateArtistInfoPageChunkItem.js b/src/content/dependencies/generateArtistInfoPageChunkItem.js
index 9d406c67..af24e150 100644
--- a/src/content/dependencies/generateArtistInfoPageChunkItem.js
+++ b/src/content/dependencies/generateArtistInfoPageChunkItem.js
@@ -1,8 +1,14 @@
 import {empty} from '#sugar';
 
 export default {
+  contentDependencies: ['generateTextWithTooltip'],
   extraDependencies: ['html', 'language'],
 
+  relations: (relation) => ({
+    textWithTooltip:
+      relation('generateTextWithTooltip'),
+  }),
+
   slots: {
     content: {
       type: 'html',
@@ -18,10 +24,13 @@ export default {
       validate: v => v.strictArrayOf(v.isHTML),
     },
 
-    rerelease: {type: 'boolean'},
+    rereleaseTooltip: {
+      type: 'html',
+      mutable: false,
+    },
   },
 
-  generate: (slots, {html, language}) =>
+  generate: (relations, slots, {html, language}) =>
     language.encapsulate('artistPage.creditList.entry', entryCapsule =>
       html.tag('li',
         slots.rerelease && {class: 'rerelease'},
@@ -29,8 +38,15 @@ export default {
         language.encapsulate(entryCapsule, workingCapsule => {
           const workingOptions = {entry: slots.content};
 
-          if (slots.rerelease) {
+          if (!html.isBlank(slots.rereleaseTooltip)) {
             workingCapsule += '.rerelease';
+            workingOptions.rerelease =
+              relations.textWithTooltip.slots({
+                attributes: {class: 'rerelease'},
+                text: language.$(entryCapsule, 'rerelease.term'),
+                tooltip: slots.rereleaseTooltip,
+              });
+
             return language.$(workingCapsule, workingOptions);
           }