diff options
Diffstat (limited to 'src/page/tag.js')
-rw-r--r-- | src/page/tag.js | 157 |
1 files changed, 79 insertions, 78 deletions
diff --git a/src/page/tag.js b/src/page/tag.js index 471439da..98b552b3 100644 --- a/src/page/tag.js +++ b/src/page/tag.js @@ -2,110 +2,111 @@ // Imports -import fixWS from 'fix-whitespace'; +import fixWS from "fix-whitespace"; // Page exports -export function condition({wikiData}) { - return wikiData.wikiInfo.enableArtTagUI; +export function condition({ wikiData }) { + return wikiData.wikiInfo.enableArtTagUI; } -export function targets({wikiData}) { - return wikiData.artTagData.filter(tag => !tag.isContentWarning); +export function targets({ wikiData }) { + return wikiData.artTagData.filter((tag) => !tag.isContentWarning); } -export function write(tag, {wikiData}) { - const { wikiInfo } = wikiData; - const { taggedInThings: things } = tag; +export function write(tag, { wikiData }) { + const { wikiInfo } = 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(); + // 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 entries = thingsReversed.map((item) => ({ item })); - const page = { - type: 'page', - path: ['tag', tag.directory], - page: ({ - generatePreviousNextLinks, - getAlbumCover, - getGridHTML, - getThemeString, - getTrackCover, - link, - language, - to - }) => ({ - title: language.$('tagPage.title', {tag: tag.name}), - theme: getThemeString(tag.color), + const page = { + type: "page", + path: ["tag", tag.directory], + page: ({ + generatePreviousNextLinks, + getAlbumCover, + getGridHTML, + getThemeString, + getTrackCover, + link, + language, + to, + }) => ({ + title: language.$("tagPage.title", { tag: tag.name }), + theme: getThemeString(tag.color), - main: { - classes: ['top-index'], - content: fixWS` - <h1>${language.$('tagPage.title', {tag: tag.name})}</h1> - <p class="quick-info">${language.$('tagPage.infoLine', { - coverArts: language.countCoverArts(things.length, {unit: true}) + main: { + classes: ["top-index"], + content: fixWS` + <h1>${language.$("tagPage.title", { tag: tag.name })}</h1> + <p class="quick-info">${language.$("tagPage.infoLine", { + coverArts: language.countCoverArts(things.length, { + unit: true, + }), })}</p> <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)) + entries, + srcFn: (thing) => + thing.album + ? getTrackCover(thing) + : getAlbumCover(thing), + linkFn: (thing, opts) => + thing.album + ? link.track(thing, opts) + : link.album(thing, opts), })} </div> - ` - }, + `, + }, - nav: generateTagNav(tag, { - generatePreviousNextLinks, - link, - language, - wikiData - }) - }) - }; + nav: generateTagNav(tag, { + generatePreviousNextLinks, + link, + language, + wikiData, + }), + }), + }; - return [page]; + return [page]; } // Utility functions -function generateTagNav(tag, { - generatePreviousNextLinks, - link, - language, - wikiData -}) { - const previousNextLinks = generatePreviousNextLinks(tag, { - data: wikiData.artTagData.filter(tag => !tag.isContentWarning), - linkKey: 'tag' - }); +function generateTagNav( + tag, + { generatePreviousNextLinks, link, language, wikiData } +) { + const previousNextLinks = generatePreviousNextLinks(tag, { + data: wikiData.artTagData.filter((tag) => !tag.isContentWarning), + linkKey: "tag", + }); - 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'}) - }) - }, - /* + 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" }), + }), + }, + /* previousNextLinks && { divider: false, html: `(${previousNextLinks})` } */ - ] - }; + ], + }; } |