From ae7a6b33c94b2c74bd5fb4fead6136bc3b9c49c1 Mon Sep 17 00:00:00 2001 From: Taken Date: Thu, 4 Sep 2025 13:03:01 +0200 Subject: [PATCH] Stated on uhc stats --- .../(stats)/player/[ign]/_stats/uhc/uhc.tsx | 42 +++++++++++++++++++ src/app/(stats)/player/[ign]/page.tsx | 2 + src/lib/schema/player.ts | 5 ++- src/lib/schema/stats.ts | 6 +++ 4 files changed, 53 insertions(+), 2 deletions(-) create mode 100644 src/app/(stats)/player/[ign]/_stats/uhc/uhc.tsx diff --git a/src/app/(stats)/player/[ign]/_stats/uhc/uhc.tsx b/src/app/(stats)/player/[ign]/_stats/uhc/uhc.tsx new file mode 100644 index 0000000..073e176 --- /dev/null +++ b/src/app/(stats)/player/[ign]/_stats/uhc/uhc.tsx @@ -0,0 +1,42 @@ +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 { devide } from "@/lib/hypixel/general" +import { NonNullStats } from "@/lib/schema/player" +import CollapsedStats from "../../_components/CollapsedStats" + +export default function UHCStats({ stats }: { stats: NonNullStats["UHC"] }) { + if (!stats) return null + + const kd = formatNumber(devide(stats.kills, stats.deaths)) + + return ( + + + + +

UHC

+
+ KD

, + stat:

{kd}

+ }, + { + title:

Wins

, + stat:

{formatNumber(stats.wins)}

+ } + ]} + /> +
+
+ + + +
+
+
+ ) +} diff --git a/src/app/(stats)/player/[ign]/page.tsx b/src/app/(stats)/player/[ign]/page.tsx index ee50cf6..d121291 100644 --- a/src/app/(stats)/player/[ign]/page.tsx +++ b/src/app/(stats)/player/[ign]/page.tsx @@ -14,6 +14,7 @@ import BuildBattleStats from "./_stats/build-battle/build-battle" import DuelsStats from "./_stats/duels/duels" import MurderMysteryStats from "./_stats/murder-mystery/murder-mystery" import SkyWarsStats from "./_stats/skywars/skywars" +import UHCStats from "./_stats/uhc/uhc" export async function generateMetadata({ params }: { params: Promise<{ ign: string }> }): Promise { const { ign } = await params @@ -100,6 +101,7 @@ async function SuspendedPage({ ign: pign }: { ign: string }) { + ) : diff --git a/src/lib/schema/player.ts b/src/lib/schema/player.ts index 7b180fa..93c58f7 100644 --- a/src/lib/schema/player.ts +++ b/src/lib/schema/player.ts @@ -1,5 +1,5 @@ import z from "zod" -import { bedwarsStatsSchema, buildBattleStatsSchema, duelsStatsSchema, murderMysteryStatsSchema, skywarsStatsSchema } from "./stats" +import { bedwarsStatsSchema, buildBattleStatsSchema, duelsStatsSchema, murderMysteryStatsSchema, skywarsStatsSchema, uhcSchema } from "./stats" export const playerSchema = z.looseObject({ player: z.looseObject({ @@ -18,7 +18,8 @@ export const playerSchema = z.looseObject({ SkyWars: skywarsStatsSchema.optional(), Duels: duelsStatsSchema.optional(), MurderMystery: murderMysteryStatsSchema.optional(), - BuildBattle: buildBattleStatsSchema.optional() + BuildBattle: buildBattleStatsSchema.optional(), + UHC: uhcSchema.optional() }).optional(), quests: z.record( z.string(), diff --git a/src/lib/schema/stats.ts b/src/lib/schema/stats.ts index 8fec08f..1111f0d 100644 --- a/src/lib/schema/stats.ts +++ b/src/lib/schema/stats.ts @@ -404,3 +404,9 @@ export const buildBattleStatsSchema = z.looseObject({ wins_solo_pro_latest: z.number().default(0), wins_speed_builders_latest: z.number().default(0) }) + +export const uhcSchema = z.looseObject({ + kills: z.number().default(0), + deaths: z.number().default(0), + wins: z.number().default(0) +})