UPdated mode stats types
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@/components/ui/table"
|
||||
import { formatNumber } from "@/lib/formatters"
|
||||
import { _BedwarsStats, concatBedwarsStats, getBedwarsModeStats, getBestMode } from "@/lib/hypixel/bedwars/bedwars"
|
||||
import { concatBedwarsStats, getBedwarsModeStats, getBestMode } from "@/lib/hypixel/bedwars/bedwars"
|
||||
import { NonNullStats } from "@/lib/schema/player"
|
||||
import { cn } from "@/lib/utils"
|
||||
|
||||
@@ -77,18 +77,16 @@ const ROWS: RowConfig[] = [
|
||||
]
|
||||
|
||||
function StatRow({ cfg, stats }: { cfg: RowConfig, stats: NonNullable<NonNullStats["Bedwars"]> }) {
|
||||
const bedwars = stats as _BedwarsStats
|
||||
|
||||
let values: (number | string)[] = []
|
||||
|
||||
if (cfg.key) {
|
||||
values = getBedwarsModeStats(cfg.key, bedwars) as (number | string)[]
|
||||
values = getBedwarsModeStats(cfg.key, stats) as (number | string)[]
|
||||
} else if (cfg.aggregateOf) {
|
||||
const rawArrays = cfg.aggregateOf.map(k => getBedwarsModeStats(k, bedwars, true))
|
||||
const rawArrays = cfg.aggregateOf.map(k => getBedwarsModeStats(k, stats, true))
|
||||
values = concatBedwarsStats(...rawArrays)
|
||||
}
|
||||
|
||||
const isBest = cfg.highlightBest && cfg.key && getBestMode(bedwars) === cfg.key
|
||||
const isBest = cfg.highlightBest && cfg.key && getBestMode(stats) === cfg.key
|
||||
|
||||
const className = cn(
|
||||
cfg.bold && "font-bold",
|
||||
|
||||
Reference in New Issue
Block a user