Switched to formatnumber func

This commit is contained in:
2025-09-01 12:21:58 +02:00
parent 32b4f2cebc
commit d58856ccd1
7 changed files with 72 additions and 62 deletions

View File

@@ -18,8 +18,8 @@ export default function SkyWarsStats(
if (!stats) return null
const level = getSkywarsLevel(stats.skywars_experience)
const kd = (stats.kills / stats.deaths).toFixed(2)
const wl = (stats.wins / stats.losses).toFixed(2)
const kd = formatNumber(stats.kills / stats.deaths)
const wl = formatNumber(stats.wins / stats.losses)
const current = getSkywarsXpForLevel(Math.floor(level))
const next = getSkywarsXpForLevel(Math.floor(level + 1))

View File

@@ -23,7 +23,7 @@ export default function SkyWarsGeneralStats({
return (
<div className="flex mb-10">
<div className="flex-1">
<BasicStat title="Level: " value={level.toFixed(2)} />
<BasicStat title="Level: " value={formatNumber(level)} />
<Stat title="Prestige: ">
<SkywarsPrestige level={Math.floor(level)} icon={stats.selected_prestige_icon} />
</Stat>
@@ -40,13 +40,13 @@ export default function SkyWarsGeneralStats({
<BasicStat title="Chests Opened: " value={formatNumber(stats.chests_opened)} />
<BasicStat title="Arrows Hit: " value={formatNumber(stats.arrows_hit)} />
<BasicStat title="Arrows Shot: " value={formatNumber(stats.arrows_shot)} />
<BasicStat title="Arrow Hit Accuracy: " value={`${((stats.arrows_hit / stats.arrows_shot) * 100).toFixed(2)}%`} />
<BasicStat title="Arrow Hit Accuracy: " value={`${formatNumber((stats.arrows_hit / stats.arrows_shot) * 100)}%`} />
</div>
<div className="flex-1">
<BasicStat title="Kills: " value={formatNumber(stats.kills)} />
<BasicStat title="Deaths: " value={formatNumber(stats.deaths)} />
<BasicStat title="Assists: " value={formatNumber(stats.assists)} />
<BasicStat title="Kill/Death Ratio: " value={(stats.kills / stats.deaths).toFixed(2)} />
<BasicStat title="Kill/Death Ratio: " value={formatNumber(stats.kills / stats.deaths)} />
<p>
<br />
</p>
@@ -64,8 +64,8 @@ export default function SkyWarsGeneralStats({
<BasicStat title="Wins: " value={formatNumber(stats.wins)} />
<BasicStat title="Lab Wins: " value={formatNumber(stats.wins_lab)} />
<BasicStat title="Losses: " value={formatNumber(stats.losses)} />
<BasicStat title="Win/Loss Ratio: " value={(stats.wins / stats.losses).toFixed(2)} />
<BasicStat title="Kill/Win Ratio: " value={(stats.kills / stats.wins).toFixed(2)} />
<BasicStat title="Win/Loss Ratio: " value={formatNumber(stats.wins / stats.losses)} />
<BasicStat title="Kill/Win Ratio: " value={formatNumber(stats.kills / stats.wins)} />
<p>
<br />
</p>