diff options
author | (quasar) nebula <qznebula@protonmail.com> | 2023-04-06 10:57:42 -0300 |
---|---|---|
committer | (quasar) nebula <qznebula@protonmail.com> | 2023-04-06 10:57:42 -0300 |
commit | 8f4473336fcf9ed94222797ce7e0c35226a90cbb (patch) | |
tree | 7143b9e1f3126407bd04a47462d8acbed37b668a /src/page/album.js | |
parent | f61b789661300238460001a91697269a00de7271 (diff) |
build steps: jank together ultra-basic page write
Super simple technically functional sketch.
Diffstat (limited to 'src/page/album.js')
-rw-r--r-- | src/page/album.js | 216 |
1 files changed, 35 insertions, 181 deletions
diff --git a/src/page/album.js b/src/page/album.js index 4ed4dfcb..6b82f84f 100644 --- a/src/page/album.js +++ b/src/page/album.js @@ -1,205 +1,59 @@ // Album page specification. -import { - bindOpts, - compareArrays, - empty, -} from '../util/sugar.js'; - -import { - getAlbumCover, - getAlbumListTag, - getTotalDuration, -} from '../util/wiki-data.js'; - -import { - u_generateAlbumStylesheet, -} from '../misc-templates.js'; - export const description = `per-album info & track artwork gallery pages`; export function targets({wikiData}) { return wikiData.albumData; } -export const dataSteps = { - contentDependencies: [ - 'generateAlbumSocialEmbed', - 'generateAlbumStylesheet', - ], - - computePathsForTarget(data, album) { - data.hasGalleryPage = album.tracks.some(t => t.hasUniqueCoverArt); - data.hasCommentaryPage = !!album.commentary || album.tracks.some(t => t.commentary); - - return [ - { - type: 'page', - path: ['album', album.directory], - }, - - data.hasGalleryPage && { - type: 'page', - path: ['albumGallery', album.directory], - }, +export function pathsForTarget(album) { + const hasGalleryPage = album.tracks.some(t => t.hasUniqueCoverArt); + const hasCommentaryPage = !!album.commentary || album.tracks.some(t => t.commentary); - data.hasCommentaryPage && { - type: 'page', - path: ['albumCommentary', album.directory], - }, + return [ + { + type: 'page', + path: ['album', album.directory], - { - type: 'data', - path: ['album', album.directory], + contentFunction: { + name: 'generateAlbumInfoPage', + args: [album], }, - ]; - }, - - computeDataCommonAcrossMixedWrites(data, album) { - data.albumDuration = getTotalDuration(album.tracks); - }, - - computeDataCommonAcrossPageWrites(data, album) { - data.listTag = getAlbumListTag(album); - }, - - computeDataForPageWrite: { - album(data, album, _pathArgs) { - // TODO: We can't use content-unfulfilled functions here. - // But how do we express that these need to be fulfilled - // from within data steps? - data.socialEmbedData = data.dependencies.generateAlbumSocialEmbed.data(album); - data.stylesheetData = data.dependencies.generateAlbumStylesheet.data(album); - - data.name = album.name; - data.color = album.color; - data.directory = album.directory; - - data.hasAdditionalFiles = !empty(album.additionalFiles); - data.numAdditionalFiles = album.additionalFiles.flatMap((g) => g.files).length; - - data.displayTrackSections = - album.trackSections && - (album.trackSections.length > 1 || - !album.trackSections[0]?.isDefaultTrackSection); - }, - }, - - computeContentForPageWrite: { - album(data, { - absoluteTo, - fancifyURL, - generateAdditionalFilesShortcut, - generateAdditionalFilesList, - generateChronologyLinks, - generateContributionLinks, - generateContentHeading, - generateNavigationLinks, - getAlbumCover, - getAlbumStylesheet, - getLinkThemeString, - getSizeOfAdditionalFile, - getThemeString, - html, - link, - language, - transformMultiline, - urls, - }) { - const generateTrackListItem = bindOpts(u_generateTrackListItem, { - generateContributionLinks, - getLinkThemeString, - html, - language, - link, - }); - - const generateAlbumSocialEmbedDescription = u_generateAlbumSocialEmbedDescription.fulfill({ - language, - }); - - const generateAlbumSocialEmbed = u_generateAlbumSocialEmbed.fulfill({ - generateSocialEmbedDescription: generateAlbumSocialEmbedDescription, - }); - - void generateTrackListItem; }, - }, -}; -/* -const infoPage = { - page: () => { - return { - banner: !empty(album.bannerArtistContribs) && { - dimensions: album.bannerDimensions, - path: [ - 'media.albumBanner', - album.directory, - album.bannerFileExtension, - ], - alt: language.$('misc.alt.albumBanner'), - position: 'top', - }, + /* + hasGalleryPage && { + type: 'page', + path: ['albumGallery', album.directory], - cover: { - src: getAlbumCover(album), - alt: language.$('misc.alt.albumCover'), - artTags: album.artTags, + contentFunction: { + name: 'generateAlbumGalleryPage', + args: [album], }, + }, - main: { - headingMode: 'sticky', + hasCommentaryPage && { + type: 'page', + path: ['albumCommentary', album.directory], - content: [ - ], + contentFunction: { + name: 'generateAlbumCommentaryPage', + args: [album], }, + }, - sidebarLeft: generateAlbumSidebar(album, null, { - fancifyURL, - getLinkThemeString, - html, - link, - language, - transformMultiline, - wikiData, - }), + { + type: 'data', + path: ['album', album.directory], - nav: { - linkContainerClasses: ['nav-links-hierarchy'], - links: [ - {toHome: true}, - { - html: language.$('albumPage.nav.album', { - album: link.album(album, {class: 'current'}), - }), - }, - { - divider: false, - html: generateAlbumNavLinks(album, null, { - generateNavigationLinks, - html, - language, - link, - }), - } - ], - content: generateAlbumChronologyLinks(album, null, { - generateChronologyLinks, - html, - }), + contentFunction: { + name: 'generateAlbumDataFile', + args: [album], }, - - secondaryNav: generateAlbumSecondaryNav(album, null, { - getLinkThemeString, - html, - language, - link, - }), - }; - }, -}; -*/ + }, + */ + ]; +} /* export function write(album, {wikiData}) { |