diff --git a/src/app/(stats)/player/[ign]/_stats/uhc/progress.tsx b/src/app/(stats)/player/[ign]/_stats/uhc/progress.tsx
new file mode 100644
index 0000000..c74aae7
--- /dev/null
+++ b/src/app/(stats)/player/[ign]/_stats/uhc/progress.tsx
@@ -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 (
+
+ )
+}
diff --git a/src/app/(stats)/player/[ign]/_stats/uhc/uhc.tsx b/src/app/(stats)/player/[ign]/_stats/uhc/uhc.tsx
index 3fde4af..af6688c 100644
--- a/src/app/(stats)/player/[ign]/_stats/uhc/uhc.tsx
+++ b/src/app/(stats)/player/[ign]/_stats/uhc/uhc.tsx
@@ -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 (
@@ -40,6 +41,7 @@ export default function UHCStats({ stats }: { stats: NonNullStats["UHC"] }) {
+
diff --git a/src/lib/hypixel/uhc/level.ts b/src/lib/hypixel/uhc/level.ts
index 967f227..9bc1e78 100644
--- a/src/lib/hypixel/uhc/level.ts
+++ b/src/lib/hypixel/uhc/level.ts
@@ -1,6 +1,6 @@
import { STARS } from "@/data/hypixel/uhc"
-export function getUhcStar(score: number): number {
+export function getUhcStarValue(score: number): number {
for (let i = STARS.length - 1; i >= 0; i--) {
if (score >= STARS[i].value) {
return i + 1
@@ -8,3 +8,16 @@ export function getUhcStar(score: number): number {
}
return 1
}
+
+export function getUhcStar(score: number) {
+ const current = getUhcStarValue(score)
+ return STARS.at(current - 1)!
+}
+
+export function getNextUhcStar(score: number) {
+ const current = getUhcStarValue(score)
+
+ if (current === 15) return STARS.at(-1)!
+
+ return STARS.at(current)!
+}