Finished first sw stats
This commit is contained in:
@@ -4,11 +4,14 @@ import { Card, CardContent } from "@/components/ui/card"
|
||||
import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "@/components/ui/collapsible"
|
||||
import { Separator } from "@/components/ui/separator"
|
||||
import { formatNumber } from "@/lib/formatters"
|
||||
import { getProgress } from "@/lib/hypixel/general"
|
||||
import { getSkywarsLevel, getSkywarsXpForLevel } from "@/lib/hypixel/skyWarsLevel"
|
||||
import { Player } from "@/lib/schema/player"
|
||||
import { ChevronDown, ChevronUp } from "lucide-react"
|
||||
import { useEffect, useRef, useState } from "react"
|
||||
import CollapsedStats from "../../_components/CollapsedStats"
|
||||
import { SkywarsLevel } from "./skywars-components"
|
||||
import { SkywarsLevel, SkywarsProgress } from "./skywars-components"
|
||||
import SkyWarsGeneralStats from "./stats"
|
||||
|
||||
export default function SkyWarsStats({ stats }: { stats: Player["player"]["stats"]["SkyWars"] }) {
|
||||
const ref = useRef<HTMLDivElement>(null)
|
||||
@@ -36,9 +39,16 @@ export default function SkyWarsStats({ stats }: { stats: Player["player"]["stats
|
||||
|
||||
if (!stats) return null
|
||||
|
||||
const level = getSkywarsLevel(stats.skywars_experience)
|
||||
const kd = (stats.kills / stats.deaths).toFixed(2)
|
||||
const wl = (stats.wins / stats.losses).toFixed(2)
|
||||
|
||||
const percent = getProgress(
|
||||
getSkywarsXpForLevel(Math.floor(level)),
|
||||
stats.skywars_experience,
|
||||
getSkywarsXpForLevel(Math.floor(level) + 1)
|
||||
)
|
||||
|
||||
return (
|
||||
<Card>
|
||||
<CardContent>
|
||||
@@ -73,6 +83,8 @@ export default function SkyWarsStats({ stats }: { stats: Player["player"]["stats
|
||||
</div>
|
||||
<CollapsibleContent>
|
||||
<Separator className="my-4" />
|
||||
<SkywarsProgress level={Math.floor(level)} percent={percent} />
|
||||
<SkyWarsGeneralStats statsChecked={stats} level={level} />
|
||||
</CollapsibleContent>
|
||||
</Collapsible>
|
||||
</CardContent>
|
||||
|
||||
Reference in New Issue
Block a user