« get me outta code hell

content, css: chronology link info - 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-18 11:27:29 -0300
committer(quasar) nebula <qznebula@protonmail.com>2024-06-18 22:56:16 -0300
commit7a10bac9cb001753467a6e66f2698125ac4c03e7 (patch)
tree249dc3b9daefd1bc87526d2ee5520da5519d15b9 /src/content/dependencies
parent29f4c5b571e960e6410f1555324a2d909bda8b2f (diff)
content, css: chronology link info
Diffstat (limited to 'src/content/dependencies')
-rw-r--r--src/content/dependencies/generateContributionTooltipChronologySection.js92
1 files changed, 69 insertions, 23 deletions
diff --git a/src/content/dependencies/generateContributionTooltipChronologySection.js b/src/content/dependencies/generateContributionTooltipChronologySection.js
index 09f409f5..5803b406 100644
--- a/src/content/dependencies/generateContributionTooltipChronologySection.js
+++ b/src/content/dependencies/generateContributionTooltipChronologySection.js
@@ -40,29 +40,75 @@ export default {
         : null),
   }),
 
-  generate: (data, relations, {html, language}) =>
-    language.encapsulate('misc.artistLink', capsule =>
+  slots: {
+    kind: {
+      validate: v =>
+        v.is(
+          'album',
+          'coverArt',
+          'flash',
+          'track',
+          'trackArt'),
+    },
+  },
+
+  generate: (data, relations, slots, {html, language}) =>
+    language.encapsulate('misc.artistLink.chronology', capsule =>
       html.tags([
-        relations.previousLink?.slots({
-          attributes: {class: 'chronology-link'},
-          content: [
-            html.tag('span', {class: 'chronology-symbol'},
-              language.$(capsule, 'previousSymbol')),
-
-            html.tag('span', {class: 'chronology-text'},
-              language.sanitize(data.previousName)),
-          ],
-        }),
-
-        relations.nextLink?.slots({
-          attributes: {class: 'chronology-link'},
-          content: [
-            html.tag('span', {class: 'chronology-symbol'},
-              language.$(capsule, 'nextSymbol')),
-
-            html.tag('span', {class: 'chronology-text'},
-              language.sanitize(data.nextName)),
-          ],
-        }),
+        html.tags([
+          relations.previousLink?.slots({
+            attributes: {class: 'chronology-link'},
+            content: [
+              html.tag('span', {class: 'chronology-symbol'},
+                language.$(capsule, 'previous.symbol')),
+
+              html.tag('span', {class: 'chronology-text'},
+                language.sanitize(data.previousName)),
+            ],
+          }),
+
+          html.tag('span', {class: 'chronology-info'},
+            {[html.onlyIfSiblings]: true},
+
+            language.encapsulate(capsule, 'previous.info', workingCapsule => {
+              const workingOptions = {};
+
+              if (slots.kind) {
+                workingCapsule += '.withKind';
+                workingOptions.kind =
+                  language.$(capsule, 'kind', slots.kind);
+              }
+
+              return language.$(workingCapsule, workingOptions);
+            })),
+        ]),
+
+        html.tags([
+          relations.nextLink?.slots({
+            attributes: {class: 'chronology-link'},
+            content: [
+              html.tag('span', {class: 'chronology-symbol'},
+                language.$(capsule, 'next.symbol')),
+
+              html.tag('span', {class: 'chronology-text'},
+                language.sanitize(data.nextName)),
+            ],
+          }),
+
+          html.tag('span', {class: 'chronology-info'},
+            {[html.onlyIfSiblings]: true},
+
+            language.encapsulate(capsule, 'next.info', workingCapsule => {
+              const workingOptions = {};
+
+              if (slots.kind) {
+                workingCapsule += '.withKind';
+                workingOptions.kind =
+                  language.$(capsule, 'kind', slots.kind);
+              }
+
+              return language.$(workingCapsule, workingOptions);
+            }))
+        ]),
       ])),
 };