From f238efbf84d262274c28c04c0881a5464caf6a03 Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Sat, 15 Jul 2023 19:56:44 -0300 Subject: content: generateArtTagGalleryPage --- src/page/index.js | 2 +- src/page/tag.js | 96 +++++++------------------------------------------------ 2 files changed, 12 insertions(+), 86 deletions(-) (limited to 'src/page') diff --git a/src/page/index.js b/src/page/index.js index e07c135..fd55050 100644 --- a/src/page/index.js +++ b/src/page/index.js @@ -16,5 +16,5 @@ export * as group from './group.js'; export * as listing from './listing.js'; // export * as news from './news.js'; export * as static from './static.js'; -// export * as tag from './tag.js'; +export * as tag from './tag.js'; export * as track from './track.js'; diff --git a/src/page/tag.js b/src/page/tag.js index 81db613..8942aea 100644 --- a/src/page/tag.js +++ b/src/page/tag.js @@ -10,90 +10,16 @@ export function targets({wikiData}) { return wikiData.artTagData.filter((tag) => !tag.isContentWarning); } -export function write(tag, {wikiData}) { - const {taggedInThings: things} = tag; - - // Display things featuring this art tag in reverse chronological order, - // sticking the most recent additions near the top! - const thingsReversed = things.slice().reverse(); - - const entries = thingsReversed.map((item) => ({item})); - - const page = { - type: 'page', - path: ['tag', tag.directory], - page: ({ - getAlbumCover, - getGridHTML, - getThemeString, - getTrackCover, - html, - language, - link, - }) => ({ - title: language.$('tagPage.title', {tag: tag.name}), - theme: getThemeString(tag.color), - - main: { - classes: ['top-index'], - headingMode: 'static', - - content: [ - html.tag('p', - {class: 'quick-info'}, - language.$('tagPage.infoLine', { - coverArts: language.countCoverArts(things.length, { - unit: true, - }), - })), - - html.tag('div', - {class: 'grid-listing'}, - getGridHTML({ - entries, - srcFn: (thing) => - thing.album - ? getTrackCover(thing) - : getAlbumCover(thing), - linkFn: (thing, opts) => - thing.album - ? link.track(thing, opts) - : link.album(thing, opts), - })), - ], - }, - - nav: generateTagNav(tag, { - link, - language, - wikiData, - }), - }), - }; - - return [page]; -} - -// Utility functions - -function generateTagNav(tag, { - language, - link, - wikiData, -}) { - return { - linkContainerClasses: ['nav-links-hierarchy'], - links: [ - {toHome: true}, - wikiData.wikiInfo.enableListings && { - path: ['localized.listingIndex'], - title: language.$('listingIndex.title'), - }, - { - html: language.$('tagPage.nav.tag', { - tag: link.tag(tag, {class: 'current'}), - }), +export function pathsForTarget(tag) { + return [ + { + type: 'page', + path: ['tag', tag.directory], + + contentFunction: { + name: 'generateArtTagGalleryPage', + args: [tag], }, - ], - }; + }, + ]; } -- cgit 1.3.0-6-gf8a5