From 7628c03571cf347a82c6b723d9ac1e9204f23338 Mon Sep 17 00:00:00 2001 From: Liam Date: Sun, 29 Oct 2023 15:50:04 +0000 Subject: [PATCH] fix null weighted pp and now show raw pp on hover of pp on score --- src/components/player/Score.tsx | 22 ++++++++++++++++++---- src/components/player/Scores.tsx | 1 + 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/src/components/player/Score.tsx b/src/components/player/Score.tsx index 5a82f9c..ae525e9 100644 --- a/src/components/player/Score.tsx +++ b/src/components/player/Score.tsx @@ -25,9 +25,15 @@ type ScoreProps = { score: ScoresaberScore; player: ScoresaberPlayer; leaderboard: ScoresaberLeaderboardInfo; + ownProfile?: ScoresaberPlayer; }; -export default function Score({ score, player, leaderboard }: ScoreProps) { +export default function Score({ + score, + player, + leaderboard, + ownProfile, +}: ScoreProps) { const isFullCombo = score.missedNotes + score.badCuts === 0; const diffName = scoresaberDifficultyNumberToName( leaderboard.difficulty.difficulty, @@ -37,6 +43,7 @@ export default function Score({ score, player, leaderboard }: ScoreProps) { const totalMissedNotes = score.missedNotes + score.badCuts; const weightedPp = formatNumber(getPpGainedFromScore(player.id, score), 2) + "pp"; + const isOwnProfile = player.id === ownProfile?.id; return (
@@ -141,7 +148,8 @@ export default function Score({ score, player, leaderboard }: ScoreProps) { tooltip={

Performance Points

-

Weighted PP: {weightedPp}

+ {weightedPp &&

Weighted PP: {weightedPp}

} +

Raw PP: {formatNumber(score.pp, 2)}pp

} /> @@ -174,8 +182,14 @@ export default function Score({ score, player, leaderboard }: ScoreProps) { tooltip={

Mistakes

-

Misses: {score.missedNotes}

-

Bad Cuts: {score.badCuts}

+ {isFullCombo ? ( +

Full Combo

+ ) : ( + <> +

Misses: {score.missedNotes}

+

Bad Cuts: {score.badCuts}

+ + )}
} icon={ diff --git a/src/components/player/Scores.tsx b/src/components/player/Scores.tsx index 8a726a1..ac7ae19 100644 --- a/src/components/player/Scores.tsx +++ b/src/components/player/Scores.tsx @@ -141,6 +141,7 @@ export default function Scores({ playerData, page, sortType }: ScoresProps) { player={playerData} score={score} leaderboard={leaderboard} + ownProfile={settingsStore?.player} /> ); })