From c75b029160248b6935e5c0f5156cc7a870311e82 Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Sun, 26 Jun 2022 18:02:27 -0300 Subject: real pragma, and some eslint fixes --- src/page/flash.js | 160 ++++++++++++++++++++++++++---------------------------- 1 file changed, 77 insertions(+), 83 deletions(-) (limited to 'src/page/flash.js') diff --git a/src/page/flash.js b/src/page/flash.js index 864f44de..340927d6 100644 --- a/src/page/flash.js +++ b/src/page/flash.js @@ -1,29 +1,29 @@ -// @format -// +/** @format */ + // Flash page and index specifications. // Imports -import fixWS from "fix-whitespace"; +import fixWS from 'fix-whitespace'; -import * as html from "../util/html.js"; +import * as html from '../util/html.js'; -import { getFlashLink } from "../util/wiki-data.js"; +import {getFlashLink} from '../util/wiki-data.js'; // Page exports -export function condition({ wikiData }) { +export function condition({wikiData}) { return wikiData.wikiInfo.enableFlashesAndGames; } -export function targets({ wikiData }) { +export function targets({wikiData}) { return wikiData.flashData; } -export function write(flash, { wikiData }) { +export function write(flash, {wikiData}) { const page = { - type: "page", - path: ["flash", flash.directory], + type: 'page', + path: ['flash', flash.directory], page: ({ fancifyFlashURL, generateChronologyLinks, @@ -36,26 +36,26 @@ export function write(flash, { wikiData }) { language, transformInline, }) => ({ - title: language.$("flashPage.title", { flash: flash.name }), + title: language.$('flashPage.title', {flash: flash.name}), theme: getThemeString(flash.color, [ `--flash-directory: ${flash.directory}`, ]), main: { content: fixWS` -

${language.$("flashPage.title", { +

${language.$('flashPage.title', { flash: flash.name, })}

${generateCoverLink({ src: getFlashCover(flash), - alt: language.$("misc.alt.flashArt"), + alt: language.$('misc.alt.flashArt'), })} -

${language.$("releaseInfo.released", { +

${language.$('releaseInfo.released', { date: language.formatDate(flash.date), })}

${ (flash.page || flash.urls?.length) && - `

${language.$("releaseInfo.playOn", { + `

${language.$('releaseInfo.playOn', { links: language.formatDisjunctionList( [ flash.page && getFlashLink(flash), @@ -69,15 +69,15 @@ export function write(flash, { wikiData }) { fixWS`

Tracks featured in ${flash.name.replace( /\.$/, - "" + '' )}:

` } ${ flash.contributorContribs.length && fixWS` -

${language.$("releaseInfo.contributors")}

+

${language.$('releaseInfo.contributors')}

` } `, }, - sidebarLeft: generateSidebarForFlash(flash, { link, language, wikiData }), + sidebarLeft: generateSidebarForFlash(flash, {link, language, wikiData}), nav: generateNavForFlash(flash, { generateChronologyLinks, generatePreviousNextLinks, @@ -125,32 +125,32 @@ export function write(flash, { wikiData }) { return [page]; } -export function writeTargetless({ wikiData }) { - const { flashActData } = wikiData; +export function writeTargetless({wikiData}) { + const {flashActData} = wikiData; const page = { - type: "page", - path: ["flashIndex"], - page: ({ getFlashGridHTML, getLinkThemeString, link, language }) => ({ - title: language.$("flashIndex.title"), + type: 'page', + path: ['flashIndex'], + page: ({getFlashGridHTML, getLinkThemeString, link, language}) => ({ + title: language.$('flashIndex.title'), main: { - classes: ["flash-index"], + classes: ['flash-index'], content: fixWS` -

${language.$("flashIndex.title")}

+

${language.$('flashIndex.title')}

-

${language.$("misc.jumpTo")}

+

${language.$('misc.jumpTo')}

${flashActData @@ -171,11 +171,11 @@ export function writeTargetless({ wikiData }) { ` ) - .join("\n")} + .join('\n')} `, }, - nav: { simple: true }, + nav: {simple: true}, }), }; @@ -186,32 +186,26 @@ export function writeTargetless({ wikiData }) { function generateNavForFlash( flash, - { - generateChronologyLinks, - generatePreviousNextLinks, - link, - language, - wikiData, - } + {generateChronologyLinks, generatePreviousNextLinks, link, language, wikiData} ) { - const { flashData, wikiInfo } = wikiData; + const {flashData, wikiInfo} = wikiData; const previousNextLinks = generatePreviousNextLinks(flash, { data: flashData, - linkKey: "flash", + linkKey: 'flash', }); return { - linkContainerClasses: ["nav-links-hierarchy"], + linkContainerClasses: ['nav-links-hierarchy'], links: [ - { toHome: true }, + {toHome: true}, { - path: ["localized.flashIndex"], - title: language.$("flashIndex.title"), + path: ['localized.flashIndex'], + title: language.$('flashIndex.title'), }, { - html: language.$("flashPage.nav.flash", { - flash: link.flash(flash, { class: "current" }), + html: language.$('flashPage.nav.flash', { + flash: link.flash(flash, {class: 'current'}), }), }, ], @@ -221,8 +215,8 @@ function generateNavForFlash( content: fixWS`
${generateChronologyLinks(flash, { - headingString: "misc.chronology.heading.flash", - contribKey: "contributorContribs", + headingString: 'misc.chronology.heading.flash', + contribKey: 'contributorContribs', getThings: (artist) => artist.flashesAsContributor, })}
@@ -230,21 +224,21 @@ function generateNavForFlash( }; } -function generateSidebarForFlash(flash, { link, language, wikiData }) { +function generateSidebarForFlash(flash, {link, language, wikiData}) { // all hard-coded, sorry :( // this doesnt have a super portable implementation/design...yet!! - const { flashActData } = wikiData; + const {flashActData} = wikiData; - const act6 = flashActData.findIndex((act) => act.name.startsWith("Act 6")); + const act6 = flashActData.findIndex((act) => act.name.startsWith('Act 6')); const postCanon = flashActData.findIndex((act) => - act.name.includes("Post Canon") + act.name.includes('Post Canon') ); const outsideCanon = postCanon + flashActData .slice(postCanon) - .findIndex((act) => !act.name.includes("Post Canon")); + .findIndex((act) => !act.name.includes('Post Canon')); const actIndex = flashActData.indexOf(flash.act); const side = actIndex < 0 ? 0 : actIndex < act6 ? 1 : actIndex <= outsideCanon ? 2 : 3; @@ -252,18 +246,18 @@ function generateSidebarForFlash(flash, { link, language, wikiData }) { return { content: fixWS` -

${link.flashIndex("", { - text: language.$("flashIndex.title"), +

${link.flashIndex('', { + text: language.$('flashIndex.title'), })}

${flashActData .filter( (act) => - act.name.startsWith("Act 1") || - act.name.startsWith("Act 6 Act 1") || - act.name.startsWith("Hiveswap") || + act.name.startsWith('Act 1') || + act.name.startsWith('Act 6 Act 1') || + act.name.startsWith('Hiveswap') || // Sorry not sorry -Yiffy - (({ index = flashActData.indexOf(act) } = {}) => + (({index = flashActData.indexOf(act)} = {}) => index < act6 ? side === 1 : index < outsideCanon @@ -271,43 +265,43 @@ function generateSidebarForFlash(flash, { link, language, wikiData }) { : true)() ) .flatMap((act) => [ - (act.name.startsWith("Act 1") && + (act.name.startsWith('Act 1') && html.tag( - "dt", - { class: ["side", side === 1 && "current"] }, + 'dt', + {class: ['side', side === 1 && 'current']}, link.flash(act.flashes[0], { - color: "#4ac925", + color: '#4ac925', text: `Side 1 (Acts 1-5)`, }) )) || - (act.name.startsWith("Act 6 Act 1") && + (act.name.startsWith('Act 6 Act 1') && html.tag( - "dt", - { class: ["side", side === 2 && "current"] }, + 'dt', + {class: ['side', side === 2 && 'current']}, link.flash(act.flashes[0], { - color: "#1076a2", + color: '#1076a2', text: `Side 2 (Acts 6-7)`, }) )) || - (act.name.startsWith("Hiveswap Act 1") && + (act.name.startsWith('Hiveswap Act 1') && html.tag( - "dt", - { class: ["side", side === 3 && "current"] }, + 'dt', + {class: ['side', side === 3 && 'current']}, link.flash(act.flashes[0], { - color: "#008282", + color: '#008282', text: `Outside Canon (Misc. Games)`, }) )), - (({ index = flashActData.indexOf(act) } = {}) => + (({index = flashActData.indexOf(act)} = {}) => index < act6 ? side === 1 : index < outsideCanon ? side === 2 : true)() && html.tag( - "dt", - { class: act === currentAct && "current" }, - link.flash(act.flashes[0], { text: act.name }) + 'dt', + {class: act === currentAct && 'current'}, + link.flash(act.flashes[0], {text: act.name}) ), act === currentAct && fixWS` @@ -315,17 +309,17 @@ function generateSidebarForFlash(flash, { link, language, wikiData }) { ${act.flashes .map((f) => html.tag( - "li", - { class: f === flash && "current" }, + 'li', + {class: f === flash && 'current'}, link.flash(f) ) ) - .join("\n")} + .join('\n')} `, ]) .filter(Boolean) - .join("\n")} + .join('\n')}
`, }; -- cgit 1.3.0-6-gf8a5