diff --git a/frontend/src/ts/elements/profile.ts b/frontend/src/ts/elements/profile.ts index 3c575dd7d..fb16bc8e5 100644 --- a/frontend/src/ts/elements/profile.ts +++ b/frontend/src/ts/elements/profile.ts @@ -300,19 +300,13 @@ export async function update( details .find(".level") .text(xpDetails.level) - .attr("aria-label", `${Numbers.abbreviateNumber(xp)} total xp`); + .attr("aria-label", `${formatXp(xp)} total xp`); details .find(".xp") - .text( - `${Numbers.abbreviateNumber(xpToDisplay)}/${Numbers.abbreviateNumber( - xpForLevel - )}` - ) + .text(`${formatXp(xpToDisplay)}/${formatXp(xpForLevel)}`) .attr( "aria-label", - `${Numbers.abbreviateNumber( - xpForLevel - xpToDisplay - )} xp until next level` + `${formatXp(xpForLevel - xpToDisplay)} xp until next level` ); details .find(".xpBar .bar") @@ -445,3 +439,11 @@ function formatTopPercentage(lbRank: SharedTypes.RankAndCount): string { if (lbRank.rank === 1) return "GOAT"; return "Top " + Numbers.roundTo2((lbRank.rank / lbRank.count) * 100) + "%"; } + +function formatXp(xp: number): string { + if (xp < 1000) { + return Math.round(xp).toString(); + } else { + return Numbers.abbreviateNumber(xp); + } +}