Updates speed uhc stats

This commit is contained in:
2025-09-17 15:17:18 +02:00
parent a9125d255c
commit cdc13c1258
7 changed files with 115 additions and 3 deletions

View File

@@ -22,6 +22,7 @@ import MegaWallsStats from "./_stats/megawalls/megawalls"
import MurderMysteryStats from "./_stats/murder-mystery/murder-mystery"
import PitStats from "./_stats/pit/pit"
import SkyWarsStats from "./_stats/skywars/skywars"
import SpeedUHCStats from "./_stats/speeduhc/speeduhc"
import TNTGamesStats from "./_stats/tnt-games/tnt-games"
import UHCStats from "./_stats/uhc/uhc"
import WoolGamesStats from "./_stats/woolgames/woolgames"
@@ -92,10 +93,11 @@ export function PlayerStats(
"copsandcrims": <CopsAndCrimsStats stats={stats.CopsAndCrims} />,
"woolgames": <WoolGamesStats stats={stats.WoolGames} />,
"blitz": <BlitzStats stats={stats.Blitz} />,
"arcade": <ArcadeStats stats={stats.Arcade} />
"arcade": <ArcadeStats stats={stats.Arcade} />,
"speeduhc": <SpeedUHCStats stats={stats.SpeedUHC} />
} as const
const defaultOrder = Object.keys(statsComponents).sort()
const defaultOrder = Object.keys(statsComponents)
const orderToUse = layout || defaultOrder
const [statsOrder, setStatsOrder] = useState<string[]>(layout || defaultOrder)

View File

@@ -0,0 +1,9 @@
import { getProgress } from "@/lib/hypixel/general"
import { getSpeedUHCScore } from "@/lib/hypixel/speeduhc/general"
import { GenericProgress } from "../../_components/GenericProgress"
export default function SpeedUHCProgress({ level, score }: { level: number, score: number }) {
const nextScore = getSpeedUHCScore(level + 1)
const percent = getProgress(0, score, nextScore)
return <GenericProgress tooltipId="speeduhcprogress" tooltipContent={`${score}/${nextScore} Score`} percent={percent} className="bg-mc-white" />
}

View File

@@ -0,0 +1,43 @@
import { Separator } from "@/components/ui/separator"
import { formatNumber } from "@/lib/formatters"
import { devide } from "@/lib/hypixel/general"
import { getSpeedUHCStar } from "@/lib/hypixel/speeduhc/general"
import { NonNullStats } from "@/lib/schema/player"
import GeneralStats from "../GeneralStats"
import SpeedUHCProgress from "./progress"
export default function SpeedUHCStats({ stats }: { stats: NonNullStats["SpeedUHC"] }) {
if (!stats) return null
const kd = formatNumber(devide(stats.kills, stats.deaths))
const wl = formatNumber(devide(stats.wins, stats.losses))
const star = getSpeedUHCStar(stats.score)
return (
<GeneralStats
id="speeduhc"
title="Speed UHC"
collapsedStats={[
{
title: <p>Star</p>,
stat: <p className="text-mc-light-purple">{`[${Math.floor(star)}❋]`}</p>
},
{
title: <p>KD</p>,
stat: <p className="text-muted-foreground">{kd}</p>
},
{
title: <p>Wins</p>,
stat: <p className="text-muted-foreground">{formatNumber(stats.wins)}</p>
},
{
title: <p>WL</p>,
stat: <p className="text-muted-foreground">{wl}</p>
}
]}
>
<Separator className="my-4" />
<SpeedUHCProgress level={Math.floor(star)} score={stats.score} />
</GeneralStats>
)
}