From 9412fefa5d53af171a91bd3b8ce958d35a7f87d7 Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Mon, 19 Dec 2022 23:27:00 -0400 Subject: HIGHLY WIP album gallery pages --- src/page/album.js | 85 +++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 83 insertions(+), 2 deletions(-) (limited to 'src/page/album.js') diff --git a/src/page/album.js b/src/page/album.js index 834f52d..ab44e65 100644 --- a/src/page/album.js +++ b/src/page/album.js @@ -52,6 +52,9 @@ export function write(album, {wikiData}) { const hasAdditionalFiles = !empty(album.additionalFiles); const albumDuration = getTotalDuration(album.tracks); + // TODO: code this obviously + const hasGalleryPage = true; + const displayTrackGroups = album.trackGroups && (album.trackGroups.length > 1 || @@ -96,7 +99,7 @@ export function write(album, {wikiData}) { }), }; - const page = { + const infoPage = { type: 'page', path: ['album', album.directory], page: ({ @@ -234,6 +237,13 @@ export function write(album, {wikiData}) { hasAdditionalFiles && generateAdditionalFilesShortcut(album.additionalFiles), + hasGalleryPage && + language.$('releaseInfo.viewGallery', { + link: link.albumGallery(album, { + text: language.$('releaseInfo.viewGallery.link'), + }), + }), + hasCommentaryEntries && language.$('releaseInfo.viewCommentary', { link: link.albumCommentary(album, { @@ -355,7 +365,78 @@ export function write(album, {wikiData}) { }, }; - return [page, data]; + // TODO: only gen if there are any tracks with art + const galleryPage = { + type: 'page', + path: ['albumGallery', album.directory], + page: ({ + // generateInfoGalleryLinks, + // generateNavigationLinks, + getAlbumCover, + getGridHTML, + getTrackCover, + // getLinkThemeString, + getThemeString, + html, + language, + link, + }) => ({ + title: language.$('albumGalleryPage.title', {album: album.name}), + + themeColor: album.color, + theme: getThemeString(album.color), + + main: { + classes: ['top-index'], + content: [ + html.tag('h1', + language.$('albumGalleryPage.title', { + album: album.name, + })), + + html.tag('p', + {class: 'quick-info'}, + (album.date + ? language.$('albumGalleryPage.infoLine.withDate', { + tracks: html.tag('b', + language.countTracks(album.tracks.length, {unit: true})), + duration: html.tag('b', + language.formatDuration(albumDuration, {unit: true})), + date: html.tag('b', + language.formatDate(album.date)), + }) + : language.$('albumGalleryPage.infoLine', { + tracks: html.tag('b', + language.countTracks(album.tracks.length, {unit: true})), + duration: html.tag('b', + language.formatDuration(albumDuration, {unit: true})), + }))), + + html.tag('div', + {class: 'grid-listing'}, + getGridHTML({ + srcFn: t => t.album ? getTrackCover(t) : getAlbumCover(t), + linkFn: (t, opts) => t.album ? link.track(t, opts) : link.album(t, opts), + noSrcTextFn: t => + language.$('misc.albumGalleryGrid.noCoverArt', { + name: t.name, + }), + + entries: [ + // {item: album}, + ...album.tracks.map(track => ({item: track})), + ], + })), + ], + }, + }), + }; + + return [ + infoPage, + galleryPage, + data, + ]; } // Utility functions -- cgit 1.3.0-6-gf8a5