diff options
Diffstat (limited to 'src/content/dependencies/generateAlbumGalleryPage.js')
-rw-r--r-- | src/content/dependencies/generateAlbumGalleryPage.js | 89 |
1 files changed, 63 insertions, 26 deletions
diff --git a/src/content/dependencies/generateAlbumGalleryPage.js b/src/content/dependencies/generateAlbumGalleryPage.js index 68b56bd9..f61b1983 100644 --- a/src/content/dependencies/generateAlbumGalleryPage.js +++ b/src/content/dependencies/generateAlbumGalleryPage.js @@ -3,8 +3,10 @@ import {compareArrays, stitchArrays} from '#sugar'; export default { contentDependencies: [ 'generateAlbumGalleryCoverArtistsLine', + 'generateAlbumGalleryNoTrackArtworksLine', 'generateAlbumGalleryStatsLine', 'generateAlbumNavAccent', + 'generateAlbumSecondaryNav', 'generateAlbumStyleRules', 'generateCoverGrid', 'generatePageLayout', @@ -51,7 +53,7 @@ export default { relation('generatePageLayout'); relations.albumStyleRules = - relation('generateAlbumStyleRules', album); + relation('generateAlbumStyleRules', album, null); relations.albumLink = relation('linkAlbum', album); @@ -59,9 +61,17 @@ export default { relations.albumNavAccent = relation('generateAlbumNavAccent', album, null); + relations.secondaryNav = + relation('generateAlbumSecondaryNav', album); + relations.statsLine = relation('generateAlbumGalleryStatsLine', album); + if (album.tracks.every(track => !track.hasUniqueCoverArt)) { + relations.noTrackArtworksLine = + relation('generateAlbumGalleryNoTrackArtworksLine'); + } + if (query.coverArtistsForAllTracks) { relations.coverArtistsLine = relation('generateAlbumGalleryCoverArtistsLine', query.coverArtistsForAllTracks); @@ -70,15 +80,25 @@ export default { relations.coverGrid = relation('generateCoverGrid'); - relations.links = - album.tracks.map(track => - relation('linkTrack', track)); + relations.links = [ + relation('linkAlbum', album), - relations.images = - album.tracks.map(track => - (track.hasUniqueCoverArt - ? relation('image', track.artTags) - : relation('image'))); + ... + album.tracks + .map(track => relation('linkTrack', track)), + ]; + + relations.images = [ + (album.hasCoverArt + ? relation('image', album.artTags) + : relation('image')), + + ... + album.tracks.map(track => + (track.hasUniqueCoverArt + ? relation('image', track.artTags) + : relation('image'))), + ]; return relations; }, @@ -89,27 +109,41 @@ export default { data.name = album.name; data.color = album.color; - data.names = - album.tracks.map(track => track.name); + data.names = [ + album.name, + ...album.tracks.map(track => track.name), + ]; - data.coverArtists = - album.tracks.map(track => { - if (query.coverArtistsForAllTracks) { - return null; - } + data.coverArtists = [ + (album.hasCoverArt + ? album.coverArtistContribs.map(({who: artist}) => artist.name) + : null), - if (track.hasUniqueCoverArt) { - return track.coverArtistContribs.map(({who: artist}) => artist.name); - } + ... + album.tracks.map(track => { + if (query.coverArtistsForAllTracks) { + return null; + } - return null; - }); + if (track.hasUniqueCoverArt) { + return track.coverArtistContribs.map(({who: artist}) => artist.name); + } + + return null; + }), + ]; - data.paths = - album.tracks.map(track => - (track.hasUniqueCoverArt - ? ['media.trackCover', track.album.directory, track.directory, track.coverArtFileExtension] - : null)); + data.paths = [ + (album.hasCoverArt + ? ['media.albumCover', album.directory, album.coverArtFileExtension] + : null), + + ... + album.tracks.map(track => + (track.hasUniqueCoverArt + ? ['media.trackCover', track.album.directory, track.directory, track.coverArtFileExtension] + : null)), + ]; return data; }, @@ -131,6 +165,7 @@ export default { mainContent: [ relations.statsLine, relations.coverArtistsLine, + relations.noTrackArtworksLine, relations.coverGrid .slots({ @@ -172,6 +207,8 @@ export default { }), }, ], + + secondaryNav: relations.secondaryNav, }); }, }; |