Finished smash heros card header

This commit is contained in:
2025-09-18 10:19:07 +02:00
parent 28a63b43b0
commit c6a4fe2a55
7 changed files with 142 additions and 4 deletions

View File

@@ -0,0 +1,51 @@
import { Separator } from "@/components/ui/separator"
import { formatNumber } from "@/lib/formatters"
import { devide } from "@/lib/hypixel/general"
import { getSmashHerosDifficultyColor, getSmashHerosMostPlayedHero } from "@/lib/hypixel/smashhero/general"
import { NonNullStats } from "@/lib/schema/player"
import GeneralStats from "../GeneralStats"
export default function SmashHerosStats({ stats }: { stats: NonNullStats["SmashHeros"] }) {
if (!stats) return null
const kd = formatNumber(devide(stats.kills, stats.deaths))
const wl = formatNumber(devide(stats.wins, stats.losses))
const mostPlayed = getSmashHerosMostPlayedHero(stats)
const diffiultyColor = getSmashHerosDifficultyColor(mostPlayed?.difficulty ?? 0)
return (
<GeneralStats
id="smashheros"
title="Smash Heros"
collapsedStats={[
{
title: <p>Main</p>,
stat: <p className={`text-mc-${diffiultyColor}`}>{mostPlayed !== null ? mostPlayed.name : "Unknown"}</p>
},
{
title: <p>Level</p>,
stat: (
<p>
<span className="text-mc-aqua">{stats.smashLevel}</span>
<span className="text-mc-gold">{"\u2736"}</span>
</p>
)
},
{
title: <p>KD</p>,
stat: <p>{kd}</p>
},
{
title: <p>Wins</p>,
stat: <p>{formatNumber(stats.wins)}</p>
},
{
title: <p>WL</p>,
stat: <p>{wl}</p>
}
]}
>
<Separator className="my-4" />
</GeneralStats>
)
}