From d32b10d56525aa155bec9397e681b92c72275057 Mon Sep 17 00:00:00 2001 From: Lee Date: Thu, 26 Oct 2023 15:56:16 +0000 Subject: [PATCH] Update src/app/player/[id]/[sort]/[page]/page.tsx --- src/app/player/[id]/[sort]/[page]/page.tsx | 104 ++++++++++----------- 1 file changed, 52 insertions(+), 52 deletions(-) diff --git a/src/app/player/[id]/[sort]/[page]/page.tsx b/src/app/player/[id]/[sort]/[page]/page.tsx index 2844efc..5018002 100644 --- a/src/app/player/[id]/[sort]/[page]/page.tsx +++ b/src/app/player/[id]/[sort]/[page]/page.tsx @@ -1,52 +1,52 @@ -import PlayerPage from "@/components/player/PlayerPage"; -import { ssrSettings } from "@/ssrSettings"; -import { formatNumber } from "@/utils/number"; -import { ScoreSaberAPI } from "@/utils/scoresaber/api"; -import { normalizedRegionName } from "@/utils/utils"; -import { Metadata } from "next"; - -type Props = { - params: { id: string; sort: string; page: string }; -}; - -export async function generateMetadata({ - params: { id }, -}: Props): Promise { - const player = await ScoreSaberAPI.fetchPlayerData(id); - if (!player) { - return { - title: "Player not found", - }; - } - - const description = ` - View ${player.name}'s scores, top plays, and more. - - Rank: #${formatNumber(player.rank)} (#${formatNumber( - player.countryRank, - )} - ${normalizedRegionName(player.country)}) - PP: ${formatNumber(player.pp)} - Play Count: ${formatNumber(player.scoreStats.totalPlayCount)}`; - - return { - title: `${player.name}`, - description: `View ${player.name}'s scores, top plays, and more.`, - openGraph: { - siteName: ssrSettings.siteName, - title: `${player.name}`, - description: description, - images: [ - { - url: player.profilePicture, - }, - ], - }, - twitter: { - card: "summary", - }, - }; -} - -export default function Player({ params: { id, sort, page } }: Props) { - return ; -} +import PlayerPage from "@/components/player/PlayerPage"; +import { ssrSettings } from "@/ssrSettings"; +import { formatNumber } from "@/utils/number"; +import { ScoreSaberAPI } from "@/utils/scoresaber/api"; +import { normalizedRegionName } from "@/utils/utils"; +import { Metadata } from "next"; + +type Props = { + params: { id: string; sort: string; page: string }; +}; + +export async function generateMetadata({ + params: { id }, +}: Props): Promise { + const player = await ScoreSaberAPI.fetchPlayerData(id); + if (!player) { + return { + title: "Player not found", + }; + } + + const description = ` + View ${player.name}'s scores, top plays, and more. + + Rank: #${formatNumber(player.rank)} (#${formatNumber( + player.countryRank, + )} - ${normalizedRegionName(player.country)}) + PP: ${formatNumber(player.pp)}pp + Play Count: ${formatNumber(player.scoreStats.totalPlayCount)}`; + + return { + title: `${player.name}`, + description: `View ${player.name}'s scores, top plays, and more.`, + openGraph: { + siteName: ssrSettings.siteName, + title: `${player.name}`, + description: description, + images: [ + { + url: player.profilePicture, + }, + ], + }, + twitter: { + card: "summary", + }, + }; +} + +export default function Player({ params: { id, sort, page } }: Props) { + return ; +}