Remove semicolons and #Content wrapper
This commit is contained in:
parent
e8843699c7
commit
e155aa72dd
1 changed files with 33 additions and 37 deletions
|
|
@ -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: 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 (
|
||||
<div id="Content">
|
||||
<Party team={props.party} raids={props.sortedRaids} />
|
||||
</div>
|
||||
);
|
||||
};
|
||||
return <Party team={props.party} raids={props.sortedRaids} />
|
||||
}
|
||||
|
||||
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
|
||||
|
|
|
|||
Loading…
Reference in a new issue