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 React, { useEffect } from 'react'
|
||||||
import { getCookie } from "cookies-next";
|
import { getCookie } from 'cookies-next'
|
||||||
import { serverSideTranslations } from "next-i18next/serverSideTranslations";
|
import { serverSideTranslations } from 'next-i18next/serverSideTranslations'
|
||||||
|
|
||||||
import Party from "~components/Party";
|
import Party from '~components/Party'
|
||||||
|
|
||||||
import { appState } from "~utils/appState";
|
import { appState } from '~utils/appState'
|
||||||
import api from "~utils/api";
|
import api from '~utils/api'
|
||||||
|
|
||||||
import type { NextApiRequest, NextApiResponse } from "next";
|
import type { NextApiRequest, NextApiResponse } from 'next'
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
party: Party;
|
party: Party
|
||||||
jobs: Job[];
|
jobs: Job[]
|
||||||
jobSkills: JobSkill[];
|
jobSkills: JobSkill[]
|
||||||
raids: Raid[];
|
raids: Raid[]
|
||||||
sortedRaids: Raid[][];
|
sortedRaids: Raid[][]
|
||||||
}
|
}
|
||||||
|
|
||||||
const PartyRoute: React.FC<Props> = (props: Props) => {
|
const PartyRoute: React.FC<Props> = (props: Props) => {
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
persistStaticData();
|
persistStaticData()
|
||||||
}, [persistStaticData]);
|
}, [persistStaticData])
|
||||||
|
|
||||||
function persistStaticData() {
|
function persistStaticData() {
|
||||||
appState.raids = props.raids;
|
appState.raids = props.raids
|
||||||
appState.jobs = props.jobs;
|
appState.jobs = props.jobs
|
||||||
appState.jobSkills = props.jobSkills;
|
appState.jobSkills = props.jobSkills
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return <Party team={props.party} raids={props.sortedRaids} />
|
||||||
<div id="Content">
|
}
|
||||||
<Party team={props.party} raids={props.sortedRaids} />
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
export const getServerSidePaths = async () => {
|
export const getServerSidePaths = async () => {
|
||||||
return {
|
return {
|
||||||
paths: [
|
paths: [
|
||||||
// Object variant:
|
// Object variant:
|
||||||
{ params: { party: "string" } },
|
{ params: { party: 'string' } },
|
||||||
],
|
],
|
||||||
fallback: true,
|
fallback: true,
|
||||||
};
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
// prettier-ignore
|
// prettier-ignore
|
||||||
export const getServerSideProps = async ({ req, res, locale, query }: { req: NextApiRequest, res: NextApiResponse, locale: string, query: { [index: string]: string } }) => {
|
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[]) => {
|
const organizeRaids = (raids: Raid[]) => {
|
||||||
// Set up empty raid for "All raids"
|
// Set up empty raid for "All raids"
|
||||||
const all = {
|
const all = {
|
||||||
id: "0",
|
id: '0',
|
||||||
name: {
|
name: {
|
||||||
en: "All raids",
|
en: 'All raids',
|
||||||
ja: "全て",
|
ja: '全て',
|
||||||
},
|
},
|
||||||
slug: "all",
|
slug: 'all',
|
||||||
level: 0,
|
level: 0,
|
||||||
group: 0,
|
group: 0,
|
||||||
element: 0,
|
element: 0,
|
||||||
};
|
}
|
||||||
|
|
||||||
const numGroups = Math.max.apply(
|
const numGroups = Math.max.apply(
|
||||||
Math,
|
Math,
|
||||||
raids.map((raid) => raid.group)
|
raids.map((raid) => raid.group)
|
||||||
);
|
)
|
||||||
let groupedRaids = [];
|
let groupedRaids = []
|
||||||
|
|
||||||
for (let i = 0; i <= numGroups; i++) {
|
for (let i = 0; i <= numGroups; i++) {
|
||||||
groupedRaids[i] = raids.filter((raid) => raid.group == i);
|
groupedRaids[i] = raids.filter((raid) => raid.group == i)
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
raids: raids,
|
raids: raids,
|
||||||
sortedRaids: groupedRaids,
|
sortedRaids: groupedRaids,
|
||||||
};
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
export default PartyRoute;
|
export default PartyRoute
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue