From 4fd479469d0b6463e5dd51ce62c227482aa813c6 Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Wed, 14 Jun 2023 12:51:51 -0300 Subject: content: generateAlbumSidebarGroupBox: isAlbumPage -> mode --- src/content/dependencies/generateAlbumSidebar.js | 5 ++--- src/content/dependencies/generateAlbumSidebarGroupBox.js | 11 +++++++---- 2 files changed, 9 insertions(+), 7 deletions(-) (limited to 'src/content/dependencies') diff --git a/src/content/dependencies/generateAlbumSidebar.js b/src/content/dependencies/generateAlbumSidebar.js index bf6b091a..a84f4357 100644 --- a/src/content/dependencies/generateAlbumSidebar.js +++ b/src/content/dependencies/generateAlbumSidebar.js @@ -7,7 +7,6 @@ export default { extraDependencies: ['html'], - relations(relation, album, track) { const relations = {}; @@ -41,7 +40,7 @@ export default { if (data.isAlbumPage) { const groupBoxes = relations.groupBoxes - .map(content => content.slot('isAlbumPage', true)) + .map(content => content.slot('mode', 'album')) .map(content => ({content})); return { @@ -56,7 +55,7 @@ export default { content: relations.groupBoxes .flatMap((content, i, {length}) => [ - content, + content.slot('mode', 'track'), i < length - 1 && html.tag('hr', { style: `border-color: var(--primary-color); border-style: none none dotted none` diff --git a/src/content/dependencies/generateAlbumSidebarGroupBox.js b/src/content/dependencies/generateAlbumSidebarGroupBox.js index e124acd9..874dcc20 100644 --- a/src/content/dependencies/generateAlbumSidebarGroupBox.js +++ b/src/content/dependencies/generateAlbumSidebarGroupBox.js @@ -46,7 +46,10 @@ export default { }, slots: { - isAlbumPage: {type: 'boolean', default: false}, + mode: { + validate: v => v.is('album', 'track'), + default: 'track', + }, }, generate(relations, slots, {html, language}) { @@ -56,7 +59,7 @@ export default { group: relations.groupLink, })), - slots.isAlbumPage && + slots.mode === 'album' && relations.description ?.slot('mode', 'multiline'), @@ -66,14 +69,14 @@ export default { links: language.formatDisjunctionList(relations.externalLinks), })), - slots.isAlbumPage && + slots.mode === 'album' && relations.nextAlbumLink && html.tag('p', {class: 'group-chronology-link'}, language.$('albumSidebar.groupBox.next', { album: relations.nextAlbumLink, })), - slots.isAlbumPage && + slots.mode === 'album' && relations.previousAlbumLink && html.tag('p', {class: 'group-chronology-link'}, language.$('albumSidebar.groupBox.previous', { -- cgit 1.3.0-6-gf8a5