add weighted pp tooltip
All checks were successful
Deploy / deploy (push) Successful in 4m36s

This commit is contained in:
Lee 2024-10-01 11:44:53 +01:00
parent 2884291063
commit 1faa97b332
4 changed files with 19 additions and 6 deletions

View File

@ -1,5 +1,3 @@
"use client";
import ScoreSaberLeaderboardToken from "@/common/model/token/scoresaber/score-saber-leaderboard-token";
import ScoreSaberScoreToken from "@/common/model/token/scoresaber/score-saber-score-token";
import LeaderboardPlayer from "./leaderboard-player";
@ -27,7 +25,7 @@ type Props = {
export default function LeaderboardScore({ player, score, leaderboard }: Props) {
return (
<div className="pb-1 pt-1">
<div className="grid items-center w-full gap-2 first:pt-0 last:pb-0 grid-cols-[20px 1fr_1fr] lg:grid-cols-[130px_4fr_300px]">
<div className="grid items-center w-full gap-2 grid-cols-[20px 1fr_1fr] lg:grid-cols-[130px_4fr_300px]">
<ScoreRankInfo score={score} />
<LeaderboardPlayer player={player} score={score} />
<LeaderboardScoreStats score={score} leaderboard={leaderboard} />

View File

@ -29,7 +29,6 @@ export default function PlayerData({
page,
}: Props) {
const isMobile = useIsMobile();
console.log("mobile", isMobile);
let player = initalPlayerData;
const { data, isLoading, isError } = useQuery({

View File

@ -18,7 +18,23 @@ const badges: ScoreBadge[] = [
if (pp === 0) {
return undefined;
}
return `${formatPp(pp)}pp`;
const weightedPp = pp * score.weight;
return (
<>
<Tooltip
display={
<div>
<p>
Weighted: {formatPp(weightedPp)}pp ({(100 * score.weight).toFixed(2)}%)
</p>
</div>
}
>
<p>{formatPp(pp)}pp</p>
</Tooltip>
</>
);
},
},
{

View File

@ -21,7 +21,7 @@ export default function StatValue({ name, color, value }: Props) {
return (
<div
className={clsx(
"flex min-w-16 gap-2 h-[28px] p-1 items-center justify-center rounded-md text-sm",
"flex min-w-16 gap-2 h-[28px] p-1 items-center justify-center rounded-md text-sm cursor-default",
color ? color : "bg-accent"
)}
style={{