« get me outta code hell

content: generateCommentaryEntry: access date tooltip - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/content/dependencies
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2024-06-21 10:16:50 -0300
committer(quasar) nebula <qznebula@protonmail.com>2024-06-21 10:47:46 -0300
commit4d040ff96841366cb024171de80751da448d7254 (patch)
treeb82d46c55f7fe38165a6ff27e12411bbaf6c36ab /src/content/dependencies
parentb6369a60d550c2c98340e6fd6e0ae1c584b9391e (diff)
content: generateCommentaryEntry: access date tooltip
Diffstat (limited to 'src/content/dependencies')
-rw-r--r--src/content/dependencies/generateCommentaryEntry.js41
1 files changed, 34 insertions, 7 deletions
diff --git a/src/content/dependencies/generateCommentaryEntry.js b/src/content/dependencies/generateCommentaryEntry.js
index 7c4aed80..9d70ec91 100644
--- a/src/content/dependencies/generateCommentaryEntry.js
+++ b/src/content/dependencies/generateCommentaryEntry.js
@@ -3,6 +3,8 @@ import {empty} from '#sugar';
 export default {
   contentDependencies: [
     'generateColorStyleAttribute',
+    'generateTextWithTooltip',
+    'generateTooltip',
     'linkArtist',
     'transformContent',
   ],
@@ -33,10 +35,18 @@ export default {
 
     colorStyle:
       relation('generateColorStyleAttribute'),
+
+    textWithTooltip:
+      relation('generateTextWithTooltip'),
+
+    tooltip:
+      relation('generateTooltip'),
   }),
 
   data: (entry) => ({
     date: entry.date,
+    accessDate: entry.accessDate,
+    accessKind: entry.accessKind,
   }),
 
   slots: {
@@ -52,15 +62,32 @@ export default {
               .slot('color', slots.color),
 
           language.encapsulate(entryCapsule, 'title', titleCapsule => [
-            html.tag('time',
-              {[html.onlyIfContent]: true},
+            relations.textWithTooltip.slots({
+              attributes: {class: 'commentary-date'},
+
+              text:
+                html.tag('time',
+                  {[html.onlyIfContent]: true},
 
-              language.$(titleCapsule, 'date', {
-                [language.onlyIfOptions]: ['date'],
+                  language.$(titleCapsule, 'date', {
+                    [language.onlyIfOptions]: ['date'],
 
-                date:
-                  language.formatDate(data.date),
-              })),
+                    date:
+                      language.formatDate(data.date),
+                  })),
+
+              tooltip:
+                data.accessKind &&
+                  relations.tooltip.slots({
+                    attributes: {class: 'commentary-date-tooltip'},
+
+                    content:
+                      language.$(titleCapsule, 'date', data.accessKind, {
+                        date:
+                          language.formatDate(data.accessDate),
+                      }),
+                  }),
+            }),
 
             language.encapsulate(titleCapsule, workingCapsule => {
               const workingOptions = {};