Stated on uhc stats
This commit is contained in:
42
src/app/(stats)/player/[ign]/_stats/uhc/uhc.tsx
Normal file
42
src/app/(stats)/player/[ign]/_stats/uhc/uhc.tsx
Normal file
@@ -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 (
|
||||||
|
<AccordionItem value="uhc">
|
||||||
|
<Card className="py-0">
|
||||||
|
<CardContent>
|
||||||
|
<AccordionTrigger className="items-center py-2 hover:no-underline hover:cursor-pointer">
|
||||||
|
<h1 className="text-xl font-bold">UHC</h1>
|
||||||
|
<div className="flex gap-4">
|
||||||
|
<CollapsedStats
|
||||||
|
stats={[
|
||||||
|
{
|
||||||
|
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>
|
||||||
|
}
|
||||||
|
]}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</AccordionTrigger>
|
||||||
|
<AccordionContent>
|
||||||
|
<Separator className="my-4" />
|
||||||
|
</AccordionContent>
|
||||||
|
</CardContent>
|
||||||
|
</Card>
|
||||||
|
</AccordionItem>
|
||||||
|
)
|
||||||
|
}
|
||||||
@@ -14,6 +14,7 @@ import BuildBattleStats from "./_stats/build-battle/build-battle"
|
|||||||
import DuelsStats from "./_stats/duels/duels"
|
import DuelsStats from "./_stats/duels/duels"
|
||||||
import MurderMysteryStats from "./_stats/murder-mystery/murder-mystery"
|
import MurderMysteryStats from "./_stats/murder-mystery/murder-mystery"
|
||||||
import SkyWarsStats from "./_stats/skywars/skywars"
|
import SkyWarsStats from "./_stats/skywars/skywars"
|
||||||
|
import UHCStats from "./_stats/uhc/uhc"
|
||||||
|
|
||||||
export async function generateMetadata({ params }: { params: Promise<{ ign: string }> }): Promise<Metadata> {
|
export async function generateMetadata({ params }: { params: Promise<{ ign: string }> }): Promise<Metadata> {
|
||||||
const { ign } = await params
|
const { ign } = await params
|
||||||
@@ -100,6 +101,7 @@ async function SuspendedPage({ ign: pign }: { ign: string }) {
|
|||||||
<DuelsStats stats={player.stats.Duels} />
|
<DuelsStats stats={player.stats.Duels} />
|
||||||
<MurderMysteryStats stats={player.stats.MurderMystery} />
|
<MurderMysteryStats stats={player.stats.MurderMystery} />
|
||||||
<BuildBattleStats stats={player.stats.BuildBattle} />
|
<BuildBattleStats stats={player.stats.BuildBattle} />
|
||||||
|
<UHCStats stats={player.stats.UHC} />
|
||||||
</Accordion>
|
</Accordion>
|
||||||
</div>
|
</div>
|
||||||
) :
|
) :
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import z from "zod"
|
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({
|
export const playerSchema = z.looseObject({
|
||||||
player: z.looseObject({
|
player: z.looseObject({
|
||||||
@@ -18,7 +18,8 @@ export const playerSchema = z.looseObject({
|
|||||||
SkyWars: skywarsStatsSchema.optional(),
|
SkyWars: skywarsStatsSchema.optional(),
|
||||||
Duels: duelsStatsSchema.optional(),
|
Duels: duelsStatsSchema.optional(),
|
||||||
MurderMystery: murderMysteryStatsSchema.optional(),
|
MurderMystery: murderMysteryStatsSchema.optional(),
|
||||||
BuildBattle: buildBattleStatsSchema.optional()
|
BuildBattle: buildBattleStatsSchema.optional(),
|
||||||
|
UHC: uhcSchema.optional()
|
||||||
}).optional(),
|
}).optional(),
|
||||||
quests: z.record(
|
quests: z.record(
|
||||||
z.string(),
|
z.string(),
|
||||||
|
|||||||
@@ -404,3 +404,9 @@ export const buildBattleStatsSchema = z.looseObject({
|
|||||||
wins_solo_pro_latest: z.number().default(0),
|
wins_solo_pro_latest: z.number().default(0),
|
||||||
wins_speed_builders_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)
|
||||||
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user