fix null weighted pp and now show raw pp on hover of pp on score
All checks were successful
deploy / deploy (push) Successful in 55s

This commit is contained in:
Lee 2023-10-29 15:50:04 +00:00
parent c6cc12fbc2
commit 7628c03571
2 changed files with 19 additions and 4 deletions

@ -25,9 +25,15 @@ type ScoreProps = {
score: ScoresaberScore; score: ScoresaberScore;
player: ScoresaberPlayer; player: ScoresaberPlayer;
leaderboard: ScoresaberLeaderboardInfo; 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 isFullCombo = score.missedNotes + score.badCuts === 0;
const diffName = scoresaberDifficultyNumberToName( const diffName = scoresaberDifficultyNumberToName(
leaderboard.difficulty.difficulty, leaderboard.difficulty.difficulty,
@ -37,6 +43,7 @@ export default function Score({ score, player, leaderboard }: ScoreProps) {
const totalMissedNotes = score.missedNotes + score.badCuts; const totalMissedNotes = score.missedNotes + score.badCuts;
const weightedPp = const weightedPp =
formatNumber(getPpGainedFromScore(player.id, score), 2) + "pp"; formatNumber(getPpGainedFromScore(player.id, score), 2) + "pp";
const isOwnProfile = player.id === ownProfile?.id;
return ( return (
<div className="grid grid-cols-1 pb-2 pt-2 first:pt-0 last:pb-0 md:grid-cols-[0.85fr_6fr_1.3fr]"> <div className="grid grid-cols-1 pb-2 pt-2 first:pt-0 last:pb-0 md:grid-cols-[0.85fr_6fr_1.3fr]">
@ -141,7 +148,8 @@ export default function Score({ score, player, leaderboard }: ScoreProps) {
tooltip={ tooltip={
<div> <div>
<p className="font-bold">Performance Points</p> <p className="font-bold">Performance Points</p>
<p>Weighted PP: {weightedPp}</p> {weightedPp && <p>Weighted PP: {weightedPp}</p>}
<p>Raw PP: {formatNumber(score.pp, 2)}pp</p>
</div> </div>
} }
/> />
@ -174,8 +182,14 @@ export default function Score({ score, player, leaderboard }: ScoreProps) {
tooltip={ tooltip={
<div> <div>
<p className="font-bold">Mistakes</p> <p className="font-bold">Mistakes</p>
{isFullCombo ? (
<p>Full Combo</p>
) : (
<>
<p>Misses: {score.missedNotes}</p> <p>Misses: {score.missedNotes}</p>
<p>Bad Cuts: {score.badCuts}</p> <p>Bad Cuts: {score.badCuts}</p>
</>
)}
</div> </div>
} }
icon={ icon={

@ -141,6 +141,7 @@ export default function Scores({ playerData, page, sortType }: ScoresProps) {
player={playerData} player={playerData}
score={score} score={score}
leaderboard={leaderboard} leaderboard={leaderboard}
ownProfile={settingsStore?.player}
/> />
); );
}) })