Fixed types on duels and mm
This commit is contained in:
@@ -69,7 +69,7 @@ export default function DuelsStats({ stats }: { stats: NonNullStats["Duels"] })
|
|||||||
</AccordionTrigger>
|
</AccordionTrigger>
|
||||||
<AccordionContent>
|
<AccordionContent>
|
||||||
<Separator className="my-4" />
|
<Separator className="my-4" />
|
||||||
<DuelsGeneralStats statsChecked={stats} div={div} kd={kd} wl={wl} />
|
<DuelsGeneralStats stats={stats} div={div} kd={kd} wl={wl} />
|
||||||
<Separator className="my-4" />
|
<Separator className="my-4" />
|
||||||
<DuelsStatsTable stats={stats} />
|
<DuelsStatsTable stats={stats} />
|
||||||
</AccordionContent>
|
</AccordionContent>
|
||||||
|
|||||||
@@ -6,10 +6,8 @@ import { cn } from "@/lib/utils"
|
|||||||
import { BasicStat } from "../../_components/Stats"
|
import { BasicStat } from "../../_components/Stats"
|
||||||
|
|
||||||
export default function DuelsGeneralStats(
|
export default function DuelsGeneralStats(
|
||||||
{ statsChecked, div, kd, wl }: { statsChecked: NonNullStats["Duels"], div: Div | null, kd: string, wl: string }
|
{ stats, div, kd, wl }: { stats: NonNullable<NonNullStats["Duels"]>, div: Div | null, kd: string, wl: string }
|
||||||
) {
|
) {
|
||||||
const stats = statsChecked!
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="flex mb-10">
|
<div className="flex mb-10">
|
||||||
<div className="flex-1">
|
<div className="flex-1">
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import { getBestDuelsMode, getDevision, getDuelsModeStats, getMode } from "@/lib
|
|||||||
import { romanize } from "@/lib/hypixel/general"
|
import { romanize } from "@/lib/hypixel/general"
|
||||||
import { NonNullStats } from "@/lib/schema/player"
|
import { NonNullStats } from "@/lib/schema/player"
|
||||||
|
|
||||||
export default function DuelsStatTable({ stats }: { stats: NonNullStats["Duels"] }) {
|
export default function DuelsStatTable({ stats }: { stats: NonNullable<NonNullStats["Duels"]> }) {
|
||||||
return (
|
return (
|
||||||
<Table>
|
<Table>
|
||||||
<DuelsTableHeader />
|
<DuelsTableHeader />
|
||||||
@@ -73,9 +73,7 @@ function DuelsTableHeader() {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
function DuelsStat({ modeId, stats }: { modeId: Parameters<typeof getMode>[0], stats: NonNullStats["Duels"] }) {
|
function DuelsStat({ modeId, stats }: { modeId: Parameters<typeof getMode>[0], stats: NonNullable<NonNullStats["Duels"]> }) {
|
||||||
if (!stats) return null
|
|
||||||
|
|
||||||
const modeStats = getDuelsModeStats(modeId, stats)
|
const modeStats = getDuelsModeStats(modeId, stats)
|
||||||
const mode = getMode(modeId)
|
const mode = getMode(modeId)
|
||||||
const bestMode = getBestDuelsMode(stats) === modeId
|
const bestMode = getBestDuelsMode(stats) === modeId
|
||||||
|
|||||||
@@ -3,9 +3,7 @@ import { devide } from "@/lib/hypixel/general"
|
|||||||
import { NonNullStats } from "@/lib/schema/player"
|
import { NonNullStats } from "@/lib/schema/player"
|
||||||
import { BasicStat } from "../../_components/Stats"
|
import { BasicStat } from "../../_components/Stats"
|
||||||
|
|
||||||
export default function InfectionStats({ stats }: { stats: NonNullStats["MurderMystery"] }) {
|
export default function InfectionStats({ stats }: { stats: NonNullable<NonNullStats["MurderMystery"]> }) {
|
||||||
if (!stats) return null
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<h2 className="text-xl font-bold">Infection</h2>
|
<h2 className="text-xl font-bold">Infection</h2>
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ export default function MurderMysteryStats({ stats }: { stats: NonNullStats["Mur
|
|||||||
</AccordionTrigger>
|
</AccordionTrigger>
|
||||||
<AccordionContent>
|
<AccordionContent>
|
||||||
<Separator className="my-4" />
|
<Separator className="my-4" />
|
||||||
<MurderMysteryGeneralStats statsChecked={stats} />
|
<MurderMysteryGeneralStats stats={stats} />
|
||||||
<Separator className="my-4" />
|
<Separator className="my-4" />
|
||||||
<InfectionStats stats={stats} />
|
<InfectionStats stats={stats} />
|
||||||
<Separator className="my-4" />
|
<Separator className="my-4" />
|
||||||
|
|||||||
@@ -4,9 +4,7 @@ import { getKnifeName } from "@/lib/hypixel/murder-mystery/general"
|
|||||||
import { NonNullStats } from "@/lib/schema/player"
|
import { NonNullStats } from "@/lib/schema/player"
|
||||||
import { BasicStat } from "../../_components/Stats"
|
import { BasicStat } from "../../_components/Stats"
|
||||||
|
|
||||||
export default function MurderMysteryGeneralStats({ statsChecked }: { statsChecked: NonNullStats["MurderMystery"] }) {
|
export default function MurderMysteryGeneralStats({ stats }: { stats: NonNullable<NonNullStats["MurderMystery"]> }) {
|
||||||
const stats = statsChecked!
|
|
||||||
|
|
||||||
const kd = formatNumber(devide(stats.kills, stats.deaths))
|
const kd = formatNumber(devide(stats.kills, stats.deaths))
|
||||||
const wl = formatNumber(devide(stats.wins, stats.losses))
|
const wl = formatNumber(devide(stats.wins, stats.losses))
|
||||||
const weapon = getKnifeName(stats.active_knife_skin)
|
const weapon = getKnifeName(stats.active_knife_skin)
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import { getBestMurderMysteryMode, getModeTitle, getMurderMysteryModeStats } fro
|
|||||||
import { NonNullStats } from "@/lib/schema/player"
|
import { NonNullStats } from "@/lib/schema/player"
|
||||||
import { cn } from "@/lib/utils"
|
import { cn } from "@/lib/utils"
|
||||||
|
|
||||||
export default function MurderMysteryStatTable({ stats }: { stats: NonNullStats["MurderMystery"] }) {
|
export default function MurderMysteryStatTable({ stats }: { stats: NonNullable<NonNullStats["MurderMystery"]> }) {
|
||||||
return (
|
return (
|
||||||
<Table>
|
<Table>
|
||||||
<MurderMysteryTableHeader />
|
<MurderMysteryTableHeader />
|
||||||
@@ -44,9 +44,9 @@ function MurderMysteryTableHeader() {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
function MurderMysteryStat({ modeId, stats }: { modeId: Parameters<typeof getMurderMysteryModeStats>[0], stats: NonNullStats["MurderMystery"] }) {
|
function MurderMysteryStat(
|
||||||
if (!stats) return null
|
{ modeId, stats }: { modeId: Parameters<typeof getMurderMysteryModeStats>[0], stats: NonNullable<NonNullStats["MurderMystery"]> }
|
||||||
|
) {
|
||||||
const title = getModeTitle(modeId)
|
const title = getModeTitle(modeId)
|
||||||
const modeStats = getMurderMysteryModeStats(modeId, stats)
|
const modeStats = getMurderMysteryModeStats(modeId, stats)
|
||||||
const bestMode = getBestMurderMysteryMode(stats) === modeId
|
const bestMode = getBestMurderMysteryMode(stats) === modeId
|
||||||
|
|||||||
Reference in New Issue
Block a user