« get me outta code hell

content: generateTrackListItem - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/content/dependencies/generateTrackListMissingDuration.js
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2024-10-20 20:08:07 -0300
committer(quasar) nebula <qznebula@protonmail.com>2024-10-20 20:09:47 -0300
commit754d37c457092f9aca96fe91b20a3ad8c295d274 (patch)
treedd6edfe96f6b1ed7893e920aca2208dd22434004 /src/content/dependencies/generateTrackListMissingDuration.js
parente1171dd824e5d697d78dae996322295b0353ae2a (diff)
content: generateTrackListItem
Turns out yeah, these are worth combining.
Diffstat (limited to 'src/content/dependencies/generateTrackListMissingDuration.js')
-rw-r--r--src/content/dependencies/generateTrackListMissingDuration.js35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/content/dependencies/generateTrackListMissingDuration.js b/src/content/dependencies/generateTrackListMissingDuration.js
new file mode 100644
index 00000000..b5917982
--- /dev/null
+++ b/src/content/dependencies/generateTrackListMissingDuration.js
@@ -0,0 +1,35 @@
+export default {
+  contentDependencies: ['generateTextWithTooltip', 'generateTooltip'],
+  extraDependencies: ['html', 'language'],
+
+  relations: (relation) => ({
+    textWithTooltip:
+      relation('generateTextWithTooltip'),
+
+    tooltip:
+      relation('generateTooltip'),
+  }),
+
+  generate: (relations, {html, language}) =>
+    language.encapsulate('trackList.item.withDuration', itemCapsule =>
+      language.encapsulate(itemCapsule, 'duration', durationCapsule =>
+        relations.textWithTooltip.slots({
+          attributes: {class: 'missing-duration'},
+          customInteractionCue: true,
+
+          text:
+            language.$(durationCapsule, {
+              duration:
+                html.tag('span', {class: 'text-with-tooltip-interaction-cue'},
+                  language.$(durationCapsule, 'missing')),
+            }),
+
+          tooltip:
+            relations.tooltip.slots({
+              attributes: {class: 'missing-duration-tooltip'},
+
+              content:
+                language.$(durationCapsule, 'missing.info'),
+            }),
+        }))),
+};