diff options
author | (quasar) nebula <qznebula@protonmail.com> | 2024-10-30 15:45:13 -0300 |
---|---|---|
committer | (quasar) nebula <qznebula@protonmail.com> | 2024-10-30 16:04:28 -0300 |
commit | fb319c8e0bf69d9925389edf674de938ea489e25 (patch) | |
tree | a60bd4f07ce72b9da394a3bf4db8fee91842eb78 /src/content/dependencies | |
parent | 859d1777a4f6f6d583466aaf72357d4d611f3909 (diff) |
data, content: remove shared and inferred additional names
Removes: - inferredAdditionalNameList (#composite/things/track) etc - sharedAdditionalNameList (#composite/things/track) etc - "specificAlbumExclusive" / "This Album Only" field - "from" property / "on {ALBUMS}" accent (content) - generateTrackAdditionalNamesBox (no leftover dynamics) - related snapshot test
Diffstat (limited to 'src/content/dependencies')
3 files changed, 4 insertions, 83 deletions
diff --git a/src/content/dependencies/generateAdditionalNamesBoxItem.js b/src/content/dependencies/generateAdditionalNamesBoxItem.js index 34c91661..e3e59a34 100644 --- a/src/content/dependencies/generateAdditionalNamesBoxItem.js +++ b/src/content/dependencies/generateAdditionalNamesBoxItem.js @@ -1,7 +1,5 @@ -import {stitchArrays} from '#sugar'; - export default { - contentDependencies: ['linkTrack', 'transformContent'], + contentDependencies: ['transformContent'], extraDependencies: ['html', 'language'], relations: (relation, entry) => ({ @@ -12,21 +10,9 @@ export default { (entry.annotation ? relation('transformContent', entry.annotation) : null), - - trackLinks: - (entry.from - ? entry.from.map(track => relation('linkTrack', track)) - : null), - }), - - data: (entry) => ({ - albumNames: - (entry.from - ? entry.from.map(track => track.album.name) - : null), }), - generate: (data, relations, {html, language}) => { + generate: (relations, {html, language}) => { const prefix = 'misc.additionalNames.item'; const itemParts = [prefix]; @@ -48,18 +34,6 @@ export default { }); } - if (relations.trackLinks) { - accentParts.push('withAlbums'); - accentOptions.albums = - language.formatConjunctionList( - stitchArrays({ - trackLink: relations.trackLinks, - albumName: data.albumNames, - }).map(({trackLink, albumName}) => - trackLink.slot('content', - language.sanitize(albumName)))); - } - if (accentParts.length > 2) { itemParts.push('withAccent'); itemOptions.accent = diff --git a/src/content/dependencies/generateTrackAdditionalNamesBox.js b/src/content/dependencies/generateTrackAdditionalNamesBox.js deleted file mode 100644 index bad04b74..00000000 --- a/src/content/dependencies/generateTrackAdditionalNamesBox.js +++ /dev/null @@ -1,53 +0,0 @@ -import {empty} from '#sugar'; - -export default { - contentDependencies: ['generateAdditionalNamesBox'], - extraDependencies: ['html'], - - query: (track) => { - const { - additionalNames: own, - sharedAdditionalNames: shared, - inferredAdditionalNames: inferred, - } = track; - - if (empty(own) && empty(shared) && empty(inferred)) { - return {combinedList: []}; - } - - const firstFilter = - (empty(own) - ? new Set() - : new Set(own.map(({name}) => name))); - - const sharedFiltered = - shared.filter(({name}) => !firstFilter.has(name)) - - const secondFilter = - new Set([ - ...firstFilter, - ...sharedFiltered.map(({name}) => name), - ]); - - const inferredFiltered = - inferred.filter(({name}) => !secondFilter.has(name)); - - return { - combinedList: [ - ...own, - ...sharedFiltered, - ...inferredFiltered, - ], - }; - }, - - relations: (relation, query) => ({ - box: - (empty(query.combinedList) - ? null - : relation('generateAdditionalNamesBox', query.combinedList)), - }), - - generate: (relations, {html}) => - relations.box ?? html.blank(), -}; diff --git a/src/content/dependencies/generateTrackInfoPage.js b/src/content/dependencies/generateTrackInfoPage.js index 9e4a4059..c3faef20 100644 --- a/src/content/dependencies/generateTrackInfoPage.js +++ b/src/content/dependencies/generateTrackInfoPage.js @@ -1,5 +1,6 @@ export default { contentDependencies: [ + 'generateAdditionalNamesBox', 'generateAlbumAdditionalFilesList', 'generateAlbumNavAccent', 'generateAlbumSecondaryNav', @@ -9,7 +10,6 @@ export default { 'generateContentHeading', 'generateContributionList', 'generatePageLayout', - 'generateTrackAdditionalNamesBox', 'generateTrackCoverArtwork', 'generateTrackInfoPageFeaturedByFlashesList', 'generateTrackInfoPageOtherReleasesList', @@ -55,7 +55,7 @@ export default { relation('generateAlbumSidebar', track.album, track), additionalNamesBox: - relation('generateTrackAdditionalNamesBox', track), + relation('generateAdditionalNamesBox', track.additionalNames), cover: (track.hasUniqueCoverArt || track.album.hasCoverArt |