From ec129ac9ce0b143ca4c325108ea66c2d0e7352ff Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Sun, 17 Nov 2024 18:16:18 -0400 Subject: content: generate{Album,}ReferencedArtworksPage --- .../generateTrackReferencedArtworksPage.js | 122 +++------------------ 1 file changed, 18 insertions(+), 104 deletions(-) (limited to 'src/content/dependencies/generateTrackReferencedArtworksPage.js') diff --git a/src/content/dependencies/generateTrackReferencedArtworksPage.js b/src/content/dependencies/generateTrackReferencedArtworksPage.js index 545276c5..ac81e525 100644 --- a/src/content/dependencies/generateTrackReferencedArtworksPage.js +++ b/src/content/dependencies/generateTrackReferencedArtworksPage.js @@ -1,23 +1,17 @@ -import {stitchArrays} from '#sugar'; - export default { contentDependencies: [ 'generateAlbumStyleRules', 'generateBackToTrackLink', - 'generateCoverGrid', - 'generatePageLayout', + 'generateReferencedArtworksPage', 'generateTrackCoverArtwork', 'generateTrackNavLinks', - 'image', - 'linkAlbum', - 'linkTrack', ], extraDependencies: ['html', 'language'], relations: (relation, track) => ({ - layout: - relation('generatePageLayout'), + page: + relation('generateReferencedArtworksPage', track.referencedArtworks), albumStyleRules: relation('generateAlbumStyleRules', track.album, track), @@ -30,21 +24,6 @@ export default { cover: relation('generateTrackCoverArtwork', track), - - coverGrid: - relation('generateCoverGrid'), - - links: - track.referencedArtworks - .map(({thing}) => - (thing.album - ? relation('linkTrack', thing) - : relation('linkAlbum', thing))), - - images: - track.referencedArtworks - .map(({thing}) => - relation('image', thing.artTags)), }), data: (track) => ({ @@ -53,91 +32,26 @@ export default { color: track.color, - - count: - track.referencedArtworks.length, - - names: - track.referencedArtworks - .map(({thing}) => thing.name), - - paths: - track.referencedArtworks - .map(({thing}) => - (thing.album - ? ['media.trackCover', thing.album.directory, thing.directory, thing.coverArtFileExtension] - : ['media.albumCover', thing.directory, thing.coverArtFileExtension])), - - dimensions: - track.referencedArtworks - .map(({thing}) => thing.coverArtDimensions), - - coverArtistNames: - track.referencedArtworks - .map(({thing}) => - thing.coverArtistContribs - .map(contrib => contrib.artist.name)), }), generate: (data, relations, {html, language}) => - language.encapsulate('trackReferencedArtworksPage', pageCapsule => - relations.layout.slots({ - title: - language.$(pageCapsule, 'title', { - track: - data.name, - }), - - subtitle: - language.$(pageCapsule, 'subtitle'), - - color: data.color, - styleRules: [relations.albumStyleRules], - - cover: - relations.cover - .slot('mode', 'primary-artists'), - - mainClasses: ['top-index'], - mainContent: [ - html.tag('p', {class: 'quick-info'}, - language.$(pageCapsule, 'statsLine', { - artworks: - language.countArtworks(data.count, { - unit: true, - }), - })), - - relations.coverGrid.slots({ - links: relations.links, - names: data.names, + relations.page.slots({ + title: + language.$('trackPage.title', { + track: + data.name, + }), - images: - stitchArrays({ - image: relations.images, - path: data.paths, - dimensions: data.dimensions, - }).map(({image, path, dimensions}) => - image.slots({ - path, - dimensions, - })), + color: data.color, + styleRules: [relations.albumStyleRules], - info: - data.coverArtistNames.map(names => - language.$('misc.coverGrid.details.coverArtists', { - artists: - language.formatUnitList(names), - })), - }), - ], + cover: relations.cover, - navLinkStyle: 'hierarchical', - navLinks: - html.resolve( - relations.navLinks - .slot('currentExtra', 'referenced-art')), + navLinks: + html.resolve( + relations.navLinks + .slot('currentExtra', 'referenced-art')), - navBottomRowContent: relations.backToTrackLink, - })), + navBottomRowContent: relations.backToTrackLink, + }), }; -- cgit 1.3.0-6-gf8a5