Added stats for general modes
This commit is contained in:
111
src/app/(stats)/player/[ign]/_stats/bedwars/bedwars-table.tsx
Normal file
111
src/app/(stats)/player/[ign]/_stats/bedwars/bedwars-table.tsx
Normal 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>
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user