re-enable player rank chart and fix country flags
All checks were successful
Deploy / deploy (push) Successful in 2m33s

This commit is contained in:
Lee 2024-09-27 21:23:44 +01:00
parent a7465a6dcd
commit 52203bbb77
3 changed files with 10 additions and 22 deletions

@ -8,7 +8,7 @@ export default function CountryFlag({ code, size = 24 }: Props) {
// eslint-disable-next-line @next/next/no-img-element // eslint-disable-next-line @next/next/no-img-element
<img <img
alt="Player Country" alt="Player Country"
src={`/assets/flags/${code}.png`} src={`/assets/flags/${code.toLowerCase()}.png`}
width={size * 2} width={size * 2}
height={size} height={size}
className={`w-[${size * 2}px] h-[${size}px] object-contain`} className={`w-[${size * 2}px] h-[${size}px] object-contain`}

@ -7,6 +7,7 @@ import { ScoreSort } from "@/common/service/score-sort";
import { useQuery } from "@tanstack/react-query"; import { useQuery } from "@tanstack/react-query";
import Mini from "../ranking/mini"; import Mini from "../ranking/mini";
import PlayerHeader from "./player-header"; import PlayerHeader from "./player-header";
import PlayerRankChart from "./player-rank-chart";
import PlayerScores from "./player-scores"; import PlayerScores from "./player-scores";
const REFRESH_INTERVAL = 5 * 60 * 1000; // 5 minutes const REFRESH_INTERVAL = 5 * 60 * 1000; // 5 minutes
@ -34,7 +35,11 @@ export default function PlayerData({ initialPlayerData: initalPlayerData, initia
<div className="flex gap-2"> <div className="flex gap-2">
<article className="flex flex-col gap-2"> <article className="flex flex-col gap-2">
<PlayerHeader player={player} /> <PlayerHeader player={player} />
{!player.inactive && <>{/* <PlayerRankChart player={player} /> */}</>} {!player.inactive && (
<>
<PlayerRankChart player={player} />
</>
)}
<PlayerScores initialScoreData={initialScoreData} player={player} sort={sort} page={page} /> <PlayerScores initialScoreData={initialScoreData} player={player} sort={sort} page={page} />
</article> </article>
<aside className="w-[500px] hidden xl:flex flex-col gap-2"> <aside className="w-[500px] hidden xl:flex flex-col gap-2">

@ -3,28 +3,11 @@
import ScoreSaberPlayerToken from "@/common/model/token/scoresaber/score-saber-player-token"; import ScoreSaberPlayerToken from "@/common/model/token/scoresaber/score-saber-player-token";
import { formatNumberWithCommas } from "@/common/number-utils"; import { formatNumberWithCommas } from "@/common/number-utils";
import { import { CategoryScale, Chart, Legend, LinearScale, LineElement, PointElement, Title, Tooltip } from "chart.js";
CategoryScale,
Chart,
Legend,
LinearScale,
LineElement,
PointElement,
Title,
Tooltip,
} from "chart.js";
import { Line } from "react-chartjs-2"; import { Line } from "react-chartjs-2";
import Card from "../card"; import Card from "../card";
Chart.register( Chart.register(LinearScale, CategoryScale, PointElement, LineElement, Title, Tooltip, Legend);
LinearScale,
CategoryScale,
PointElement,
LineElement,
Title,
Tooltip,
Legend,
);
export const options: any = { export const options: any = {
maintainAspectRatio: false, maintainAspectRatio: false,
@ -122,7 +105,7 @@ export default function PlayerRankChart({ player }: Props) {
}; };
return ( return (
<Card className="h-96"> <Card className="h-96 w-full">
<Line className="w-fit" options={options} data={data} /> <Line className="w-fit" options={options} data={data} />
</Card> </Card>
); );