diff --git a/pages/p/[party].tsx b/pages/p/[party].tsx index 106f8a83..bc8715c1 100644 --- a/pages/p/[party].tsx +++ b/pages/p/[party].tsx @@ -1,49 +1,45 @@ -import React, { useEffect } from "react"; -import { getCookie } from "cookies-next"; -import { serverSideTranslations } from "next-i18next/serverSideTranslations"; +import React, { useEffect } from 'react' +import { getCookie } from 'cookies-next' +import { serverSideTranslations } from 'next-i18next/serverSideTranslations' -import Party from "~components/Party"; +import Party from '~components/Party' -import { appState } from "~utils/appState"; -import api from "~utils/api"; +import { appState } from '~utils/appState' +import api from '~utils/api' -import type { NextApiRequest, NextApiResponse } from "next"; +import type { NextApiRequest, NextApiResponse } from 'next' interface Props { - party: Party; - jobs: Job[]; - jobSkills: JobSkill[]; - raids: Raid[]; - sortedRaids: Raid[][]; + party: Party + jobs: Job[] + jobSkills: JobSkill[] + raids: Raid[] + sortedRaids: Raid[][] } const PartyRoute: React.FC = (props: Props) => { useEffect(() => { - persistStaticData(); - }, [persistStaticData]); + persistStaticData() + }, [persistStaticData]) function persistStaticData() { - appState.raids = props.raids; - appState.jobs = props.jobs; - appState.jobSkills = props.jobSkills; + appState.raids = props.raids + appState.jobs = props.jobs + appState.jobSkills = props.jobSkills } - return ( -
- -
- ); -}; + return +} export const getServerSidePaths = async () => { return { paths: [ // Object variant: - { params: { party: "string" } }, + { params: { party: 'string' } }, ], fallback: true, - }; -}; + } +} // prettier-ignore export const getServerSideProps = async ({ req, res, locale, query }: { req: NextApiRequest, res: NextApiResponse, locale: string, query: { [index: string]: string } }) => { @@ -95,31 +91,31 @@ export const getServerSideProps = async ({ req, res, locale, query }: { req: Nex const organizeRaids = (raids: Raid[]) => { // Set up empty raid for "All raids" const all = { - id: "0", + id: '0', name: { - en: "All raids", - ja: "全て", + en: 'All raids', + ja: '全て', }, - slug: "all", + slug: 'all', level: 0, group: 0, element: 0, - }; + } const numGroups = Math.max.apply( Math, raids.map((raid) => raid.group) - ); - let groupedRaids = []; + ) + let groupedRaids = [] for (let i = 0; i <= numGroups; i++) { - groupedRaids[i] = raids.filter((raid) => raid.group == i); + groupedRaids[i] = raids.filter((raid) => raid.group == i) } return { raids: raids, sortedRaids: groupedRaids, - }; -}; + } +} -export default PartyRoute; +export default PartyRoute