Skip to content

Commit

Permalink
content: generateAlbumSecondaryNav: guest track accent
Browse files Browse the repository at this point in the history
  • Loading branch information
towerofnix committed Apr 5, 2024
1 parent 5a4e10d commit 780b9ef
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 5 deletions.
25 changes: 20 additions & 5 deletions src/content/dependencies/generateAlbumSecondaryNav.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,14 +94,24 @@ export default {
return relations;
},

data: (query, album, _track) => {
const data = {};

data.groupIsGuest =
query.groups
.map(group => !album.groups.includes(group));

return data;
},

slots: {
mode: {
validate: v => v.is('album', 'track'),
default: 'album',
},
},

generate(relations, slots, {html, language}) {
generate(data, relations, slots, {html, language}) {
const navLinksShouldShowPreviousNext =
(slots.mode === 'track'
? Array.from(relations.previousNextLinks ?? [], () => false)
Expand Down Expand Up @@ -138,12 +148,17 @@ export default {

const navLinkContents =
stitchArrays({
groupIsGuest: data.groupIsGuest,
groupLink: relations.groupLinks,
previousNextLinks: navLinkPreviousNextLinks,
}).map(({groupLink, previousNextLinks}) => [
language.$('albumSidebar.groupBox.title', {
group: groupLink,
}),
}).map(({groupIsGuest, groupLink, previousNextLinks}) => [
(groupIsGuest
? language.$('albumSidebar.groupBox.title.guestTrack', {
group: groupLink,
})
: language.$('albumSidebar.groupBox.title', {
group: groupLink,
})),

previousNextLinks &&
`(${language.formatUnitList(previousNextLinks.content)})`,
Expand Down
2 changes: 2 additions & 0 deletions src/strings-default.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -772,6 +772,8 @@ albumSidebar:

groupBox:
title: "{GROUP}"
title.guestTrack: "{GROUP} (guest track)"

next: "Next: {ALBUM}"
previous: "Previous: {ALBUM}"

Expand Down

0 comments on commit 780b9ef

Please sign in to comment.