Added stats for general modes

This commit is contained in:
2025-08-21 02:20:01 +02:00
parent a4bf768c83
commit b31ef97789
10 changed files with 306 additions and 109 deletions

View File

@@ -0,0 +1,111 @@
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@/components/ui/table"
import { _BedwarsStats, getBedwarsModeStats } from "@/lib/hypixel/bedwars"
import { Player } from "@/lib/schema/player"
export default function BedwarsStatTable({ stats }: { stats: Player["player"]["stats"]["Bedwars"] }) {
return (
<Table>
<BedwarsTableHeader />
<TableBody>
<SoloStats stats={stats} />
<DoublesStats stats={stats} />
<ThreesStats stats={stats} />
<FoursStats stats={stats} />
</TableBody>
</Table>
)
}
function BedwarsTableHeader() {
const headerElements = [
"Mode",
"Kills",
"Deaths",
"KD",
"Kills",
"Deaths",
"KD",
"Wins",
"Losses",
"WL",
"WS",
"BB",
"BL",
"BBL"
]
return (
<TableHeader>
<TableRow>
<TableHead></TableHead>
<TableHead colSpan={3}>Normal</TableHead>
<TableHead colSpan={3}>Finals</TableHead>
</TableRow>
<TableRow>
{headerElements.map((v, i) => {
return <TableHead key={i}>{v}</TableHead>
})}
</TableRow>
</TableHeader>
)
}
function SoloStats({ stats }: { stats: Player["player"]["stats"]["Bedwars"] }) {
const modeStats = getBedwarsModeStats("solo", stats as _BedwarsStats)
if (!modeStats) return null
return (
<TableRow>
<TableCell>Solo</TableCell>
{modeStats.map((v, i) => {
return <TableCell key={i}>{v}</TableCell>
})}
</TableRow>
)
}
function DoublesStats({ stats }: { stats: Player["player"]["stats"]["Bedwars"] }) {
const modeStats = getBedwarsModeStats("doubles", stats as _BedwarsStats)
if (!modeStats) return null
return (
<TableRow>
<TableCell>Doubles</TableCell>
{modeStats.map((v, i) => {
return <TableCell key={i}>{v}</TableCell>
})}
</TableRow>
)
}
function ThreesStats({ stats }: { stats: Player["player"]["stats"]["Bedwars"] }) {
const modeStats = getBedwarsModeStats("3s", stats as _BedwarsStats)
if (!modeStats) return null
return (
<TableRow>
<TableCell>3v3v3v3</TableCell>
{modeStats.map((v, i) => {
return <TableCell key={i}>{v}</TableCell>
})}
</TableRow>
)
}
function FoursStats({ stats }: { stats: Player["player"]["stats"]["Bedwars"] }) {
const modeStats = getBedwarsModeStats("4s", stats as _BedwarsStats)
if (!modeStats) return null
return (
<TableRow>
<TableCell>4v4v4v4</TableCell>
{modeStats.map((v, i) => {
return <TableCell key={i}>{v}</TableCell>
})}
</TableRow>
)
}

View File

@@ -10,6 +10,7 @@ import { ChevronDown, ChevronUp, Menu } from "lucide-react"
import { useEffect, useRef, useState } from "react"
import CollapsedStats from "../../_components/CollapsedStats"
import { BedwarsLevel, BedwarsProgress } from "./bedwars-components"
import BedwarsStatTable from "./bedwars-table"
import BedwarsGeneralStats from "./stats"
export default function BedwarsStats({ stats }: { stats: Player["player"]["stats"]["Bedwars"] }) {
@@ -97,6 +98,8 @@ export default function BedwarsStats({ stats }: { stats: Player["player"]["stats
<Separator className="my-4" />
<BedwarsProgress level={level} percent={percent} />
<BedwarsGeneralStats statsChecked={stats} level={level} percent={percent} bbl={bbl} kd={kd} fkd={fkd} wl={wl} />
<Separator className="my-4" />
<BedwarsStatTable stats={stats} />
</CollapsibleContent>
</Collapsible>
</CardContent>

View File

@@ -18,7 +18,7 @@ export default function BedwarsGeneralStats(
const stats = statsChecked!
return (
<div className="flex">
<div className="flex mb-10">
<div className="flex-1">
<BasicStat title="Level: " value={`${level}.${percent.toFixed(0)}`} />
<Stat title="Prestige: ">