Finished uhc progress

This commit is contained in:
2025-09-04 20:17:15 +02:00
parent 6f90d0caa5
commit 1646cb7492
3 changed files with 40 additions and 3 deletions

View File

@@ -0,0 +1,22 @@
import { formatNumber } from "@/lib/formatters"
import { getProgress } from "@/lib/hypixel/general"
import { getNextUhcStar, getUhcStar } from "@/lib/hypixel/uhc/level"
import GenericProgress from "../../_components/GenericProgress"
export default function UHCProgress({ score }: { score: number }) {
const current = getUhcStar(score)
const next = getNextUhcStar(score)
const percent = getProgress(0, score, next.value)
return (
<div className="flex gap-2 items-center">
<GenericProgress
percent={percent}
tooltipId="uhc-progress"
tooltipContent={`${formatNumber(score)}/${formatNumber(next.value)} Score`}
className={`bg-mc-${current.color}`}
/>
<p className={`text-mc-${next.color}`}>{next.name}</p>
</div>
)
}

View File

@@ -3,15 +3,16 @@ import { Card, CardContent } from "@/components/ui/card"
import { Separator } from "@/components/ui/separator"
import { formatNumber } from "@/lib/formatters"
import { devide } from "@/lib/hypixel/general"
import { getUhcStar } from "@/lib/hypixel/uhc/level"
import { getUhcStarValue } from "@/lib/hypixel/uhc/level"
import { NonNullStats } from "@/lib/schema/player"
import CollapsedStats from "../../_components/CollapsedStats"
import UHCProgress from "./progress"
export default function UHCStats({ stats }: { stats: NonNullStats["UHC"] }) {
if (!stats) return null
const kd = formatNumber(devide(stats.kills, stats.deaths))
const star = getUhcStar(stats.score)
const star = getUhcStarValue(stats.score)
return (
<AccordionItem value="uhc">
@@ -40,6 +41,7 @@ export default function UHCStats({ stats }: { stats: NonNullStats["UHC"] }) {
</AccordionTrigger>
<AccordionContent>
<Separator className="my-4" />
<UHCProgress score={stats.score} />
</AccordionContent>
</CardContent>
</Card>