Added blitz stat card
This commit is contained in:
46
src/app/(stats)/player/[ign]/_stats/blitz/blitz.tsx
Normal file
46
src/app/(stats)/player/[ign]/_stats/blitz/blitz.tsx
Normal file
@@ -0,0 +1,46 @@
|
||||
import { Separator } from "@/components/ui/separator"
|
||||
import { formatNumber } from "@/lib/formatters"
|
||||
import { getBlitzMostPlayedKit } from "@/lib/hypixel/blitz/general"
|
||||
import { devide } from "@/lib/hypixel/general"
|
||||
import { NonNullStats } from "@/lib/schema/player"
|
||||
import { cn } from "@/lib/utils"
|
||||
import GeneralStats from "../GeneralStats"
|
||||
|
||||
export default function BlitzStats({ stats }: { stats: NonNullStats["Blitz"] }) {
|
||||
if (!stats) return null
|
||||
|
||||
const kd = formatNumber(devide(stats.kills, stats.deaths))
|
||||
const wins = stats.wins_solo_normal + stats.wins_team_normal
|
||||
const mostPlayedKit = getBlitzMostPlayedKit(stats)
|
||||
|
||||
return (
|
||||
<GeneralStats
|
||||
id="blitz"
|
||||
title="Blitz SG"
|
||||
collapsedStats={[
|
||||
{
|
||||
title: <p>Main</p>,
|
||||
stat: (
|
||||
<p className={cn(mostPlayedKit === null && "text-muted-foreground")}>
|
||||
{mostPlayedKit !== null ? mostPlayedKit.name : "Unknown"}
|
||||
</p>
|
||||
)
|
||||
},
|
||||
{
|
||||
title: <p>Kills</p>,
|
||||
stat: <p className="text-muted-foreground">{formatNumber(stats.kills)}</p>
|
||||
},
|
||||
{
|
||||
title: <p>KD</p>,
|
||||
stat: <p className="text-muted-foreground">{kd}</p>
|
||||
},
|
||||
{
|
||||
title: <p>Wins</p>,
|
||||
stat: <p className="text-muted-foreground">{wins}</p>
|
||||
}
|
||||
]}
|
||||
>
|
||||
<Separator className="my-4" />
|
||||
</GeneralStats>
|
||||
)
|
||||
}
|
||||
@@ -12,6 +12,7 @@ import { Suspense } from "react"
|
||||
import { PlayerPageLoadText } from "./_client"
|
||||
import Sidebar from "./_components/Sidebar"
|
||||
import BedwarsStats from "./_stats/bedwars/bedwars"
|
||||
import BlitzStats from "./_stats/blitz/blitz"
|
||||
import BuildBattleStats from "./_stats/build-battle/build-battle"
|
||||
import CopsAndCrimsStats from "./_stats/copsandcrims/copsandcrims"
|
||||
import DuelsStats from "./_stats/duels/duels"
|
||||
@@ -127,6 +128,7 @@ async function SuspendedPage({ params }: Pick<PageProps<"/player/[ign]">, "param
|
||||
<MegaWallsStats stats={player.stats.MegaWalls} />
|
||||
<CopsAndCrimsStats stats={player.stats.CopsAndCrims} />
|
||||
<WoolGamesStats stats={player.stats.WoolGames} />
|
||||
<BlitzStats stats={player.stats.Blitz} />
|
||||
</Accordion>
|
||||
</div>
|
||||
) :
|
||||
|
||||
Reference in New Issue
Block a user