From 8d4fd5907863dcbeece604a88854beab2e1119a1 Mon Sep 17 00:00:00 2001 From: "Kalle (Sendou)" <38327916+Sendouc@users.noreply.github.com> Date: Fri, 20 Nov 2020 15:55:57 +0200 Subject: [PATCH] add month/year to player page --- components/player/PlayerTable.tsx | 25 ++++++++++++++++---- pages/player/[id].tsx | 39 ++++++++++++++++--------------- 2 files changed, 41 insertions(+), 23 deletions(-) diff --git a/components/player/PlayerTable.tsx b/components/player/PlayerTable.tsx index 47dd1a3bf..a1bc47f14 100644 --- a/components/player/PlayerTable.tsx +++ b/components/player/PlayerTable.tsx @@ -1,4 +1,5 @@ import { Text } from "@chakra-ui/react"; +import { Trans } from "@lingui/macro"; import ModeImage from "components/common/ModeImage"; import { Table, @@ -28,10 +29,24 @@ const PlayerPage: React.FC = ({ placements }) => { - {t("xsearch;Name")} - {t("xsearch;X Power")} - {t("xsearch;Mode")} - {t("freeagents;Weapon")} + + Name + + + X Power + + + Mode + + + Weapon + + + Month + + + Year + @@ -51,6 +66,8 @@ const PlayerPage: React.FC = ({ placements }) => { + {record.month} + {record.year} ); })} diff --git a/pages/player/[id].tsx b/pages/player/[id].tsx index 93c673ebc..11b7e76be 100644 --- a/pages/player/[id].tsx +++ b/pages/player/[id].tsx @@ -10,9 +10,27 @@ import { const prisma = DBClient.getInstance().prisma; -// FIXME: should probably not prerender all player pages -- where userId is not null +const PlayerPage = ({ placements }: Props) => { + // FIXME: spinner + if (!placements) return null; + + return ( + <> + + + + ); +}; + export const getStaticPaths: GetStaticPaths = async () => { - const players = await prisma.player.findMany({}); + const players = await prisma.player.findMany({ + where: { NOT: [{ userId: null }] }, + }); return { paths: players.map((p) => ({ params: { id: p.switchAccountId } })), fallback: true, @@ -34,21 +52,4 @@ export const getStaticProps: GetStaticProps = async ({ params }) => { }; }; -const PlayerPage = ({ placements }: Props) => { - // FIXME: spinner - if (!placements) return null; - - return ( - <> - - - - ); -}; - export default PlayerPage;