diff options
author | (quasar) nebula <qznebula@protonmail.com> | 2024-04-23 14:44:51 -0300 |
---|---|---|
committer | (quasar) nebula <qznebula@protonmail.com> | 2024-05-30 20:48:17 -0300 |
commit | fe8f774aeb51eb9167421a1c5f6356163e04af04 (patch) | |
tree | 72cb31e350440c500464b94aa89fc6dcb58bd84b /src/content/dependencies/generateChronologyLinks.js | |
parent | 88d6ff83332c4b089a4386efa9cb4469cfef555f (diff) |
content: generateChronologyLinks: "Only track by..."
Diffstat (limited to 'src/content/dependencies/generateChronologyLinks.js')
-rw-r--r-- | src/content/dependencies/generateChronologyLinks.js | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/src/content/dependencies/generateChronologyLinks.js b/src/content/dependencies/generateChronologyLinks.js index 8ec6ee0a..0158ffd5 100644 --- a/src/content/dependencies/generateChronologyLinks.js +++ b/src/content/dependencies/generateChronologyLinks.js @@ -4,6 +4,11 @@ export default { extraDependencies: ['html', 'language'], slots: { + showOnly: { + type: 'boolean', + default: false, + }, + chronologyInfoSets: { validate: v => v.strictArrayOf( @@ -24,9 +29,17 @@ export default { return html.blank(); } + let infoSets = slots.chronologyInfoSets; + + if (!slots.showOnly) { + infoSets = infoSets + .filter(({nextLink, previousLink}) => + nextLink || previousLink); + } + const totalContributionCount = accumulateSum( - slots.chronologyInfoSets, + infoSets, ({contributions}) => contributions.length); if (totalContributionCount === 0) { @@ -39,7 +52,7 @@ export default { } return html.tags( - slots.chronologyInfoSets.map(({ + infoSets.map(({ headingString, contributions, }) => @@ -52,7 +65,11 @@ export default { const heading = html.tag('span', {class: 'heading'}, language.$(headingString, { - index: language.formatIndex(index), + index: + (previousLink || nextLink + ? language.formatIndex(index) + : language.formatString('misc.chronology.heading.onlyIndex')), + artist: artistLink, })); |