Fix number formatting

This commit is contained in:
Liam 2022-10-29 11:14:03 +01:00
parent cd8f5adce3
commit 664e497e87
2 changed files with 25 additions and 4 deletions

@ -46,7 +46,11 @@ const PlayerStats = () => {
</div> </div>
<div className={styles.playerStats}> <div className={styles.playerStats}>
<p> <p>
{pp}pp{" "} {pp.toLocaleString("en-us", {
maximumSignificantDigits: 2,
minimumSignificantDigits: 2,
})}
pp{" "}
<span <span
style={{ style={{
fontSize: "23px", fontSize: "23px",
@ -55,9 +59,21 @@ const PlayerStats = () => {
({leaderboardType}) ({leaderboardType})
</span> </span>
</p> </p>
<p>#{globalPos}</p> <p>
#
{globalPos.toLocaleString("en-us", {
maximumSignificantDigits: 2,
minimumSignificantDigits: 2,
})}
</p>
<div className={styles.playerCountry}> <div className={styles.playerCountry}>
<p>#{countryRank}</p> <p>
#
{countryRank.toLocaleString("en-us", {
maximumSignificantDigits: 2,
minimumSignificantDigits: 2,
})}
</p>
<ReactCountryFlag <ReactCountryFlag
className={styles.playerCountryIcon} className={styles.playerCountryIcon}
svg svg

@ -26,7 +26,12 @@ export default function ScoreStats() {
<div className={styles.scoreStats}> <div className={styles.scoreStats}>
<div className={styles.scoreStatsInfo}> <div className={styles.scoreStatsInfo}>
<p>{percentage}</p> <p>{percentage}</p>
<p>{currentScore.toLocaleString()}</p> <p>
{currentScore.toLocaleString("en-us", {
maximumSignificantDigits: 2,
minimumSignificantDigits: 2,
})}
</p>
{currentPP !== undefined ? <p>{currentPP.toFixed(0)}pp</p> : null} {currentPP !== undefined ? <p>{currentPP.toFixed(0)}pp</p> : null}
</div> </div>
<p className={styles.scoreStatsAverageCut}>Average Cut</p> <p className={styles.scoreStatsAverageCut}>Average Cut</p>