finished woolgames progress
This commit is contained in:
25
src/app/(stats)/player/[ign]/_stats/woolgames/progress.tsx
Normal file
25
src/app/(stats)/player/[ign]/_stats/woolgames/progress.tsx
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
import { formatNumber } from "@/lib/formatters"
|
||||||
|
import { getWoolGamesPrestige, getWoolGamesXPForLevel } from "@/lib/hypixel/woolgames/general"
|
||||||
|
import { GenericProgress } from "../../_components/GenericProgress"
|
||||||
|
|
||||||
|
export default function WoolGamesProgress({ xp, level }: { xp: number, level: number }) {
|
||||||
|
const pres = getWoolGamesPrestige(Math.floor(level))
|
||||||
|
const next = getWoolGamesPrestige(Math.floor(level) + 1)
|
||||||
|
const percent = (level - Math.floor(level)) * 100
|
||||||
|
|
||||||
|
const xpProgress = formatNumber(Math.floor(xp - getWoolGamesXPForLevel(Math.floor(level))))
|
||||||
|
const ceilingXp = formatNumber(Math.floor(getWoolGamesXPForLevel(Math.floor(level) + 1) - getWoolGamesXPForLevel(Math.floor(level))))
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="flex gap-2">
|
||||||
|
<p className={`text-mc-${pres.color}`}>{Math.floor(level)}</p>
|
||||||
|
<GenericProgress
|
||||||
|
tooltipId="woolgamesprogress"
|
||||||
|
tooltipContent={`${xpProgress}/${ceilingXp} XP`}
|
||||||
|
percent={percent}
|
||||||
|
className="bg-mc-red"
|
||||||
|
/>
|
||||||
|
<p className={`text-mc-${next.color}`}>{Math.floor(level) + 1}</p>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
@@ -4,6 +4,7 @@ import { getWoolGamesLevel, getWoolGamesPrestige, getWoolGamesPretigeIcon } from
|
|||||||
import { NonNullStats } from "@/lib/schema/player"
|
import { NonNullStats } from "@/lib/schema/player"
|
||||||
import Multicolored from "../../_components/Multicolored"
|
import Multicolored from "../../_components/Multicolored"
|
||||||
import GeneralStats from "../GeneralStats"
|
import GeneralStats from "../GeneralStats"
|
||||||
|
import WoolGamesProgress from "./progress"
|
||||||
|
|
||||||
export default function WoolGamesStats({ stats }: { stats: NonNullStats["WoolGames"] }) {
|
export default function WoolGamesStats({ stats }: { stats: NonNullStats["WoolGames"] }) {
|
||||||
if (!stats) return null
|
if (!stats) return null
|
||||||
@@ -34,6 +35,7 @@ export default function WoolGamesStats({ stats }: { stats: NonNullStats["WoolGam
|
|||||||
]}
|
]}
|
||||||
>
|
>
|
||||||
<Separator className="my-4" />
|
<Separator className="my-4" />
|
||||||
|
<WoolGamesProgress xp={stats.progression?.experience || 0} level={level} />
|
||||||
</GeneralStats>
|
</GeneralStats>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user