From 7a10bac9cb001753467a6e66f2698125ac4c03e7 Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Tue, 18 Jun 2024 11:27:29 -0300 Subject: content, css: chronology link info --- ...generateContributionTooltipChronologySection.js | 92 ++++++++++++++++------ 1 file changed, 69 insertions(+), 23 deletions(-) (limited to 'src/content/dependencies/generateContributionTooltipChronologySection.js') 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); + })) + ]), ])), }; -- cgit 1.3.0-6-gf8a5