Update src/app/player/[id]/[sort]/[page]/page.tsx
Some checks failed
deploy / deploy (push) Failing after 57s
Some checks failed
deploy / deploy (push) Failing after 57s
This commit is contained in:
parent
e20f7bb250
commit
d32b10d565
@ -1,52 +1,52 @@
|
|||||||
import PlayerPage from "@/components/player/PlayerPage";
|
import PlayerPage from "@/components/player/PlayerPage";
|
||||||
import { ssrSettings } from "@/ssrSettings";
|
import { ssrSettings } from "@/ssrSettings";
|
||||||
import { formatNumber } from "@/utils/number";
|
import { formatNumber } from "@/utils/number";
|
||||||
import { ScoreSaberAPI } from "@/utils/scoresaber/api";
|
import { ScoreSaberAPI } from "@/utils/scoresaber/api";
|
||||||
import { normalizedRegionName } from "@/utils/utils";
|
import { normalizedRegionName } from "@/utils/utils";
|
||||||
import { Metadata } from "next";
|
import { Metadata } from "next";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
params: { id: string; sort: string; page: string };
|
params: { id: string; sort: string; page: string };
|
||||||
};
|
};
|
||||||
|
|
||||||
export async function generateMetadata({
|
export async function generateMetadata({
|
||||||
params: { id },
|
params: { id },
|
||||||
}: Props): Promise<Metadata> {
|
}: Props): Promise<Metadata> {
|
||||||
const player = await ScoreSaberAPI.fetchPlayerData(id);
|
const player = await ScoreSaberAPI.fetchPlayerData(id);
|
||||||
if (!player) {
|
if (!player) {
|
||||||
return {
|
return {
|
||||||
title: "Player not found",
|
title: "Player not found",
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
const description = `
|
const description = `
|
||||||
View ${player.name}'s scores, top plays, and more.
|
View ${player.name}'s scores, top plays, and more.
|
||||||
|
|
||||||
Rank: #${formatNumber(player.rank)} (#${formatNumber(
|
Rank: #${formatNumber(player.rank)} (#${formatNumber(
|
||||||
player.countryRank,
|
player.countryRank,
|
||||||
)} - ${normalizedRegionName(player.country)})
|
)} - ${normalizedRegionName(player.country)})
|
||||||
PP: ${formatNumber(player.pp)}
|
PP: ${formatNumber(player.pp)}pp
|
||||||
Play Count: ${formatNumber(player.scoreStats.totalPlayCount)}`;
|
Play Count: ${formatNumber(player.scoreStats.totalPlayCount)}`;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
title: `${player.name}`,
|
title: `${player.name}`,
|
||||||
description: `View ${player.name}'s scores, top plays, and more.`,
|
description: `View ${player.name}'s scores, top plays, and more.`,
|
||||||
openGraph: {
|
openGraph: {
|
||||||
siteName: ssrSettings.siteName,
|
siteName: ssrSettings.siteName,
|
||||||
title: `${player.name}`,
|
title: `${player.name}`,
|
||||||
description: description,
|
description: description,
|
||||||
images: [
|
images: [
|
||||||
{
|
{
|
||||||
url: player.profilePicture,
|
url: player.profilePicture,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
twitter: {
|
twitter: {
|
||||||
card: "summary",
|
card: "summary",
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function Player({ params: { id, sort, page } }: Props) {
|
export default function Player({ params: { id, sort, page } }: Props) {
|
||||||
return <PlayerPage id={id} sort={sort} page={page} />;
|
return <PlayerPage id={id} sort={sort} page={page} />;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user