Added a general stats component
This commit is contained in:
@@ -1,11 +1,9 @@
|
||||
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 { getBedwarsLevelForExp, getTotalBedwarsExpForLevel } from "@/lib/hypixel/bedwars/level"
|
||||
import { devide, getProgress } from "@/lib/hypixel/general"
|
||||
import { NonNullStats } from "@/lib/schema/player"
|
||||
import CollapsedStats from "../../_components/CollapsedStats"
|
||||
import GeneralStats from "../GeneralStats"
|
||||
import { BedwarsLevel, BedwarsProgress } from "./components"
|
||||
import BedwarsGeneralStats from "./stats"
|
||||
import BedwarsStatTable from "./table"
|
||||
@@ -27,51 +25,41 @@ export default function BedwarsStats({ stats }: { stats: NonNullStats["Bedwars"]
|
||||
const ceilingXp = next - current
|
||||
|
||||
return (
|
||||
<AccordionItem value="bedwars">
|
||||
<Card className="py-0">
|
||||
<CardContent>
|
||||
<AccordionTrigger className="items-center py-2 hover:no-underline hover:cursor-pointer">
|
||||
<h1 className="text-xl font-bold">BedWars</h1>
|
||||
<div className="flex gap-4">
|
||||
<CollapsedStats
|
||||
stats={[
|
||||
{
|
||||
title: <p>Level</p>,
|
||||
stat: <BedwarsLevel xp={stats.Experience} />
|
||||
},
|
||||
{
|
||||
title: <p>WS</p>,
|
||||
stat: <p className="text-muted-foreground">{stats.winstreak ?? "?"}</p>
|
||||
},
|
||||
{
|
||||
title: <p>KD</p>,
|
||||
stat: <p className="text-muted-foreground">{kd}</p>
|
||||
},
|
||||
{
|
||||
title: <p>FKD</p>,
|
||||
stat: <p className="text-muted-foreground">{fkd}</p>
|
||||
},
|
||||
{
|
||||
title: <p>WL</p>,
|
||||
stat: <p className="text-muted-foreground">{wl}</p>
|
||||
},
|
||||
{
|
||||
title: <p>BBL</p>,
|
||||
stat: <p className="text-muted-foreground">{bbl}</p>
|
||||
}
|
||||
]}
|
||||
/>
|
||||
</div>
|
||||
</AccordionTrigger>
|
||||
<AccordionContent>
|
||||
<Separator className="my-4" />
|
||||
<BedwarsProgress level={level} percent={percent} currentXp={xpProgress} ceilingXp={ceilingXp} />
|
||||
<BedwarsGeneralStats stats={stats} level={level} percent={percent} bbl={bbl} kd={kd} fkd={fkd} wl={wl} />
|
||||
<Separator className="my-4" />
|
||||
<BedwarsStatTable stats={stats} />
|
||||
</AccordionContent>
|
||||
</CardContent>
|
||||
</Card>
|
||||
</AccordionItem>
|
||||
<GeneralStats
|
||||
id="bedwars"
|
||||
title="BedWars"
|
||||
collapsedStats={[
|
||||
{
|
||||
title: <p>Level</p>,
|
||||
stat: <BedwarsLevel xp={stats.Experience} />
|
||||
},
|
||||
{
|
||||
title: <p>WS</p>,
|
||||
stat: <p className="text-muted-foreground">{stats.winstreak ?? "?"}</p>
|
||||
},
|
||||
{
|
||||
title: <p>KD</p>,
|
||||
stat: <p className="text-muted-foreground">{kd}</p>
|
||||
},
|
||||
{
|
||||
title: <p>FKD</p>,
|
||||
stat: <p className="text-muted-foreground">{fkd}</p>
|
||||
},
|
||||
{
|
||||
title: <p>WL</p>,
|
||||
stat: <p className="text-muted-foreground">{wl}</p>
|
||||
},
|
||||
{
|
||||
title: <p>BBL</p>,
|
||||
stat: <p className="text-muted-foreground">{bbl}</p>
|
||||
}
|
||||
]}
|
||||
>
|
||||
<Separator className="my-4" />
|
||||
<BedwarsProgress level={level} percent={percent} currentXp={xpProgress} ceilingXp={ceilingXp} />
|
||||
<BedwarsGeneralStats stats={stats} level={level} percent={percent} bbl={bbl} kd={kd} fkd={fkd} wl={wl} />
|
||||
<Separator className="my-4" />
|
||||
<BedwarsStatTable stats={stats} />
|
||||
</GeneralStats>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user