From 1faa97b3321140f31ce0977b23a446b2b047106e Mon Sep 17 00:00:00 2001 From: Liam Date: Tue, 1 Oct 2024 11:44:53 +0100 Subject: [PATCH] add weighted pp tooltip --- .../leaderboard/leaderboard-score.tsx | 4 +--- src/components/player/player-data.tsx | 1 - src/components/score/score-stats.tsx | 18 +++++++++++++++++- src/components/stat-value.tsx | 2 +- 4 files changed, 19 insertions(+), 6 deletions(-) diff --git a/src/components/leaderboard/leaderboard-score.tsx b/src/components/leaderboard/leaderboard-score.tsx index 1fc0350..19bcc3b 100644 --- a/src/components/leaderboard/leaderboard-score.tsx +++ b/src/components/leaderboard/leaderboard-score.tsx @@ -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 (
-
+
diff --git a/src/components/player/player-data.tsx b/src/components/player/player-data.tsx index 9a83b06..374f488 100644 --- a/src/components/player/player-data.tsx +++ b/src/components/player/player-data.tsx @@ -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({ diff --git a/src/components/score/score-stats.tsx b/src/components/score/score-stats.tsx index bfd5c88..01f8360 100644 --- a/src/components/score/score-stats.tsx +++ b/src/components/score/score-stats.tsx @@ -18,7 +18,23 @@ const badges: ScoreBadge[] = [ if (pp === 0) { return undefined; } - return `${formatPp(pp)}pp`; + const weightedPp = pp * score.weight; + + return ( + <> + +

+ Weighted: {formatPp(weightedPp)}pp ({(100 * score.weight).toFixed(2)}%) +

+
+ } + > +

{formatPp(pp)}pp

+ + + ); }, }, { diff --git a/src/components/stat-value.tsx b/src/components/stat-value.tsx index 66db5c2..c73bdd3 100644 --- a/src/components/stat-value.tsx +++ b/src/components/stat-value.tsx @@ -21,7 +21,7 @@ export default function StatValue({ name, color, value }: Props) { return (