diff options
author | (quasar) nebula <qznebula@protonmail.com> | 2024-04-23 14:32:38 -0300 |
---|---|---|
committer | (quasar) nebula <qznebula@protonmail.com> | 2024-05-30 20:48:17 -0300 |
commit | 88d6ff83332c4b089a4386efa9cb4469cfef555f (patch) | |
tree | 46fb441fc77dc3d8fbb10c88dfef1da56cebd09f /src/content/dependencies | |
parent | 4b38b2227544db2f0420a22f2880c14857cfbecd (diff) |
content, client, css: generateScopedTrackChronologyLinks: dynamics
Diffstat (limited to 'src/content/dependencies')
-rw-r--r-- | src/content/dependencies/generateScopedTrackChronologyLinks.js | 50 | ||||
-rw-r--r-- | src/content/dependencies/generateTrackChronologyLinks.js | 11 |
2 files changed, 46 insertions, 15 deletions
diff --git a/src/content/dependencies/generateScopedTrackChronologyLinks.js b/src/content/dependencies/generateScopedTrackChronologyLinks.js index 6fc3f6eb..fb43203b 100644 --- a/src/content/dependencies/generateScopedTrackChronologyLinks.js +++ b/src/content/dependencies/generateScopedTrackChronologyLinks.js @@ -10,6 +10,8 @@ export default { 'linkTrack', ], + extraDependencies: ['html', 'language'], + relations(relation, album, track) { const albumFilter = (album @@ -71,17 +73,39 @@ export default { }; }, - generate: (relations) => - relations.chronologyLinks.slots({ - chronologyInfoSets: [ - { - headingString: 'misc.chronology.heading.track', - contributions: relations.artistChronologyContributions, - }, - { - headingString: 'misc.chronology.heading.coverArt', - contributions: relations.coverArtistChronologyContributions, - }, - ], - }), + slots: { + scope: { + validate: v => v.is('wiki', 'album'), + }, + + visible: {type: 'boolean'}, + }, + + generate: (relations, slots, {html, language}) => + html.tag('div', {class: 'scoped-chronology'}, + {class: 'scope-' + slots.scope}, + slots.visible && {style: 'display: block'}, + + [ + html.tag('p', + language.$('trackPage.nav.chronology.scope', { + scope: + html.tag('a', {class: 'scoped-chronology-switcher'}, + {href: '#'}, + language.$('trackPage.nav.chronology.scope', slots.scope)), + })), + + relations.chronologyLinks.slots({ + chronologyInfoSets: [ + { + headingString: 'misc.chronology.heading.track', + contributions: relations.artistChronologyContributions, + }, + { + headingString: 'misc.chronology.heading.coverArt', + contributions: relations.coverArtistChronologyContributions, + }, + ], + }), + ]), }; diff --git a/src/content/dependencies/generateTrackChronologyLinks.js b/src/content/dependencies/generateTrackChronologyLinks.js index ba4428a5..33911c79 100644 --- a/src/content/dependencies/generateTrackChronologyLinks.js +++ b/src/content/dependencies/generateTrackChronologyLinks.js @@ -12,7 +12,14 @@ export default { generate: (relations, {html}) => html.tags([ - relations.wikiChronologyLinks, - relations.albumChronologyLinks, + relations.wikiChronologyLinks.slots({ + scope: 'wiki', + visible: true, + }), + + relations.albumChronologyLinks.slots({ + scope: 'album', + visible: false, + }), ]), }; |