Switched to formatnumber func
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
import { AccordionContent, AccordionItem, AccordionTrigger } from "@/components/ui/accordion"
|
||||
import { Card, CardContent } from "@/components/ui/card"
|
||||
import { Separator } from "@/components/ui/separator"
|
||||
import { formatNumber } from "@/lib/formatters"
|
||||
import { getBWLevelForExp, getTotalExpForLevel } from "@/lib/hypixel/bedwars/level"
|
||||
import { getProgress } from "@/lib/hypixel/general"
|
||||
import { NonNullStats } from "@/lib/schema/player"
|
||||
@@ -14,10 +15,10 @@ import BedwarsStatTable from "./table"
|
||||
export default function BedwarsStats({ stats }: { stats: NonNullStats["Bedwars"] }) {
|
||||
if (!stats) return null
|
||||
|
||||
const kd = (stats.kills_bedwars / stats.deaths_bedwars).toFixed(2)
|
||||
const fkd = (stats.final_kills_bedwars / stats.final_deaths_bedwars).toFixed(2)
|
||||
const wl = (stats.wins_bedwars / stats.losses_bedwars).toFixed(2)
|
||||
const bbl = (stats.beds_broken_bedwars / stats.beds_lost_bedwars).toFixed(2)
|
||||
const kd = formatNumber(stats.kills_bedwars / stats.deaths_bedwars)
|
||||
const fkd = formatNumber(stats.final_kills_bedwars / stats.final_deaths_bedwars)
|
||||
const wl = formatNumber(stats.wins_bedwars / stats.losses_bedwars)
|
||||
const bbl = formatNumber(stats.beds_broken_bedwars / stats.beds_lost_bedwars)
|
||||
const level = getBWLevelForExp(stats.Experience)
|
||||
|
||||
const current = getTotalExpForLevel(level)
|
||||
|
||||
@@ -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))
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user