Fixed skywars types

This commit is contained in:
2025-09-03 13:24:35 +02:00
parent 5ed9133ce9
commit ee44397e4c
4 changed files with 8 additions and 19 deletions

View File

@@ -70,9 +70,11 @@ export function HeadsBar({ heads, heads_total }: { heads: [string, number][], he
return (
<>
<div className="flex mt-2 mb-4">
{heads.map(([key, total], index) => {
{heads.map(([key, total]) => {
const head = getHeads(key)
const percent = heads_total === 0 ? 0 : total / heads_total
const percent = total / heads_total
if (percent === 0) return null
return (
<div
@@ -80,12 +82,7 @@ export function HeadsBar({ heads, heads_total }: { heads: [string, number][], he
data-tooltip-id="heads-bar"
data-tooltip-content={`${total} ${head === null ? "Undefined" : head.name} heads`}
key={key}
className={cn(
"h-5",
head === null ? "bg-background" : `bg-mc-${head.color}`,
index === 0 ? "rounded-l-md" : undefined,
index === heads.length - 1 ? "rounded-r-md" : undefined
)}
className={cn("h-5 first:rounded-l-md last:rounded-r-md", head === null ? "bg-background" : `bg-mc-${head.color}`)}
style={{
width: `${percent * 100}%`
}}

View File

@@ -65,7 +65,7 @@ export default function SkyWarsStats(
<AccordionContent>
<Separator className="my-4" />
<SkywarsProgress level={Math.floor(level)} percent={levelProgress} currentXp={xpProgress} ceilingXp={ceilingXp} />
<SkyWarsGeneralStats statsChecked={stats} level={level} />
<SkyWarsGeneralStats stats={stats} level={level} />
<Separator className="my-4" />
<SkywarsStatTable stats={stats} />
<Separator className="my-4" />

View File

@@ -4,15 +4,7 @@ import { NonNullStats } from "@/lib/schema/player"
import { BasicStat, Stat } from "../../_components/Stats"
import { SkywarsPrestige } from "./components"
export default function SkyWarsGeneralStats({
statsChecked,
level
}: {
statsChecked: NonNullStats["SkyWars"]
level: number
}) {
const stats = statsChecked!
export default function SkyWarsGeneralStats({ stats, level }: { stats: NonNullable<NonNullStats["SkyWars"]>, level: number }) {
function getCorruptionLevel() {
let num = stats.angel_of_death_level + stats.angels_offering

View File

@@ -4,7 +4,7 @@ import { _SkywarsStats, concatSkywarsStats, getBestMode, getSkywarsModeStats } f
import { NonNullStats } from "@/lib/schema/player"
import { cn } from "@/lib/utils"
export default function SkywarsStatTable({ stats }: { stats: NonNullStats["SkyWars"] }) {
export default function SkywarsStatTable({ stats }: { stats: NonNullable<NonNullStats["SkyWars"]> }) {
return (
<Table>
<SkywarsTableHeader />