From a7465a6dcdf46e685039a6475d6754d3f24561e9 Mon Sep 17 00:00:00 2001 From: Liam Date: Fri, 27 Sep 2024 21:19:44 +0100 Subject: [PATCH] add global and country ranking cards on the player page --- src/app/(pages)/page.tsx | 15 +- src/app/(pages)/player/[...slug]/page.tsx | 17 +-- src/app/layout.tsx | 2 +- src/common/leaderboards.ts | 10 +- .../score-saber-players-page-token.ts | 14 ++ src/common/number-utils.ts | 10 ++ src/common/service/impl/scoresaber.ts | 100 ++++++++----- src/components/country-flag.tsx | 7 +- src/components/player/player-data.tsx | 36 ++--- src/components/player/player-header.tsx | 19 +-- src/components/ranking/mini.tsx | 131 ++++++++++++++++++ src/components/score/score-stats.tsx | 35 ++--- src/components/score/score.tsx | 6 +- 13 files changed, 285 insertions(+), 117 deletions(-) create mode 100644 src/common/model/token/scoresaber/score-saber-players-page-token.ts create mode 100644 src/components/ranking/mini.tsx diff --git a/src/app/(pages)/page.tsx b/src/app/(pages)/page.tsx index 607f00a..1e1e403 100644 --- a/src/app/(pages)/page.tsx +++ b/src/app/(pages)/page.tsx @@ -1,5 +1,18 @@ "use client"; +import Card from "@/components/card"; + export default function Home() { - return <>home page; + return ( +
+
+ +

hello

+
+ +

hello

+
+
+
+ ); } diff --git a/src/app/(pages)/player/[...slug]/page.tsx b/src/app/(pages)/player/[...slug]/page.tsx index e083c4f..ff49b04 100644 --- a/src/app/(pages)/player/[...slug]/page.tsx +++ b/src/app/(pages)/player/[...slug]/page.tsx @@ -1,6 +1,6 @@ +import { formatNumberWithCommas, formatPp } from "@/common/number-utils"; import { scoresaberService } from "@/common/service/impl/scoresaber"; import { ScoreSort } from "@/common/service/score-sort"; -import { formatNumberWithCommas } from "@/common/number-utils"; import PlayerData from "@/components/player/player-data"; import { format } from "@formkit/tempo"; import { Metadata } from "next"; @@ -12,9 +12,7 @@ type Props = { }; }; -export async function generateMetadata({ - params: { slug }, -}: Props): Promise { +export async function generateMetadata({ params: { slug } }: Props): Promise { const id = slug[0]; // The players id const player = await scoresaberService.lookupPlayer(id, false); if (player === undefined) { @@ -31,8 +29,8 @@ export async function generateMetadata({ openGraph: { title: `ScoreSaber Reloaded - ${player.name}`, description: ` - PP: ${formatNumberWithCommas(player.pp)}pp - Rank: #${formatNumberWithCommas(player.rank)} (#${formatNumberWithCommas(player.countryRank)} ${player.country}) + PP: ${formatPp(player.pp)}pp + Rank: #${formatNumberWithCommas(player.rank)} (#${formatPp(player.countryRank)} ${player.country}) Joined ScoreSaber: ${format(player.firstSeen, { date: "medium", time: "short" })} View the scores for ${player.name}!`, @@ -58,12 +56,7 @@ export default async function Search({ params: { slug } }: Props) { return (
- +
); } diff --git a/src/app/layout.tsx b/src/app/layout.tsx index f8fcacc..573b7f7 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -72,7 +72,7 @@ export default function RootLayout({
-
+
{children}