From 4793c04918a62189c040c7aade490f7a9a8b8b36 Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Sat, 2 Nov 2024 23:08:33 -0300 Subject: content: gGIPAlbumsListItem: group-disconnected albums --- .../generateGroupInfoPageAlbumsListItem.js | 29 +++++++++++++++++++--- src/strings-default.yaml | 1 + 2 files changed, 27 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/content/dependencies/generateGroupInfoPageAlbumsListItem.js b/src/content/dependencies/generateGroupInfoPageAlbumsListItem.js index f0e1e39c..99e7e8ff 100644 --- a/src/content/dependencies/generateGroupInfoPageAlbumsListItem.js +++ b/src/content/dependencies/generateGroupInfoPageAlbumsListItem.js @@ -24,7 +24,7 @@ export default { return {otherGroups}; }, - relations: (relation, query, album) => ({ + relations: (relation, query, album, _group) => ({ colorStyle: relation('generateColorStyleAttribute', album.color), @@ -44,13 +44,21 @@ export default { .map(group => relation('linkGroup', group)), }), + data: (_query, album, group) => ({ + groupName: + group.name, + + notFromThisGroup: + !group.albums.includes(album), + }), + slots: { accentMode: { validate: v => v.is('groups', 'artists'), }, }, - generate: (relations, slots, {html, language}) => + generate: (data, relations, slots, {html, language}) => html.tag('li', relations.colorStyle, @@ -74,7 +82,22 @@ export default { const otherGroupCapsule = language.encapsulate(itemCapsule, 'withOtherGroup'); - if (slots.accentMode === 'groups' && !empty(relations.otherGroupLinks)) { + if ( + (slots.accentMode === 'groups' || + slots.accentMode === null) && + data.notFromThisGroup + ) { + workingCapsule += '.withOtherGroup'; + workingOptions.otherGroupAccent = + html.tag('span', {class: 'other-group-accent'}, + language.$(otherGroupCapsule, 'notFromThisGroup', { + group: + data.groupName, + })); + } else if ( + slots.accentMode === 'groups' && + !empty(relations.otherGroupLinks) + ) { workingCapsule += '.withOtherGroup'; workingOptions.otherGroupAccent = html.tag('span', {class: 'other-group-accent'}, diff --git a/src/strings-default.yaml b/src/strings-default.yaml index 853a60f9..5838aa7d 100644 --- a/src/strings-default.yaml +++ b/src/strings-default.yaml @@ -1349,6 +1349,7 @@ groupInfoPage: {ALBUM} {OTHER_GROUP_ACCENT} accent: "(from {GROUPS})" + notFromThisGroup: "(not from {GROUP})" withArtists: _: >- -- cgit 1.3.0-6-gf8a5