diff --git a/src/app/(stats)/player/[ign]/_components/CollapsedStats.tsx b/src/app/(stats)/player/[ign]/_components/CollapsedStats.tsx
new file mode 100644
index 0000000..de85f5f
--- /dev/null
+++ b/src/app/(stats)/player/[ign]/_components/CollapsedStats.tsx
@@ -0,0 +1,23 @@
+import { ReactNode } from "react"
+
+type collapsedStatsProps = {
+ stats: {
+ title: ReactNode
+ stat: ReactNode
+ }[]
+}
+
+export default function CollapsedStats({ stats }: collapsedStatsProps) {
+ return (
+ <>
+ {stats.map((s, i) => {
+ return (
+
+ {s.title}
+ {s.stat}
+
+ )
+ })}
+ >
+ )
+}
diff --git a/src/app/(stats)/player/[ign]/_components/Multicolored.tsx b/src/app/(stats)/player/[ign]/_components/Multicolored.tsx
new file mode 100644
index 0000000..961f553
--- /dev/null
+++ b/src/app/(stats)/player/[ign]/_components/Multicolored.tsx
@@ -0,0 +1,23 @@
+export default function Multicolored({ val, color }: { val: string, color: string | string[] }) {
+ if (typeof color === "string") {
+ return (
+
+ {val}
+
+ )
+ }
+
+ const valArray = val.split("")
+
+ return (
+
+ {valArray.map((v, i) => {
+ return (
+
+ {v}
+
+ )
+ })}
+
+ )
+}
diff --git a/src/app/(stats)/player/[ign]/_components/stats/bedewars.tsx b/src/app/(stats)/player/[ign]/_components/stats/bedewars.tsx
index 35fa8b6..605cd5c 100644
--- a/src/app/(stats)/player/[ign]/_components/stats/bedewars.tsx
+++ b/src/app/(stats)/player/[ign]/_components/stats/bedewars.tsx
@@ -2,12 +2,15 @@
import { Card, CardContent } from "@/components/ui/card"
import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "@/components/ui/collapsible"
+import { getBedwarsStar } from "@/lib/hypixel/bedwars"
import { getBWLevelForExp } from "@/lib/hypixel/bedwarsLevel"
import { bedwarsLevelColors } from "@/lib/hypixelFormatters"
import { Player } from "@/lib/schema/player"
-import { cn } from "@/lib/utils"
+import { Separator } from "@radix-ui/react-separator"
import { ChevronDown, ChevronUp, Menu } from "lucide-react"
import { useEffect, useRef, useState } from "react"
+import CollapsedStats from "../CollapsedStats"
+import Multicolored from "../Multicolored"
export default function BedwarsStats({ stats }: { stats: Player["player"]["stats"]["Bedwars"] }) {
const ref = useRef(null)
@@ -35,6 +38,11 @@ export default function BedwarsStats({ stats }: { stats: Player["player"]["stats
if (!stats) return null
+ const kd = (stats.kills_bedwars / stats.deaths_bedwars).toFixed(2)
+ const fkd = (stats.final_kills_bedwars / stats.final_deaths_bedwars).toFixed(2)
+ const wl = (stats.wins_bedwars / stats.losses_bedwars).toFixed(2)
+ const bbl = (stats.beds_broken_bedwars / stats.beds_lost_bedwars).toFixed(2)
+
return (
@@ -42,10 +50,34 @@ export default function BedwarsStats({ stats }: { stats: Player["player"]["stats
Bedwars
-
+
Level,
+ stat:
+ },
+ {
+ title: WS
,
+ stat: {stats.winstreak ?? "?"}
+ },
+ {
+ title: KD
,
+ stat: {kd}
+ },
+ {
+ title: FKD
,
+ stat: {fkd}
+ },
+ {
+ title: WL
,
+ stat: {wl}
+ },
+ {
+ title: BBL
,
+ stat: {bbl}
+ }
+ ]}
+ />
@@ -55,7 +87,7 @@ export default function BedwarsStats({ stats }: { stats: Player["player"]["stats
- {stats.Experience}
+
@@ -66,22 +98,8 @@ export default function BedwarsStats({ stats }: { stats: Player["player"]["stats
function BedwarsLevel({ xp }: { xp: number }) {
const level = getBWLevelForExp(xp)
const color = bedwarsLevelColors(level)
+ const star = getBedwarsStar(level)
+ const val = `[${level}${star}]`
- if (typeof color === "string") {
- return (
-
- {`[${level}⭐]`}
-
- )
- }
-
- const levelArray = `[${level}⭐]`.split("")
-
- return (
-
- {levelArray.map((v, i) => {
- return {v}
- })}
-
- )
+ return
}
diff --git a/src/lib/hypixel/bedwars.ts b/src/lib/hypixel/bedwars.ts
new file mode 100644
index 0000000..ac7fcf7
--- /dev/null
+++ b/src/lib/hypixel/bedwars.ts
@@ -0,0 +1,17 @@
+import { PRESTIGE_ICONS } from "@/data/hypixel/bedwars"
+
+export function getBedwarsStar(level: number) {
+ if (level < 1100) {
+ return PRESTIGE_ICONS[0].symbol
+ }
+
+ if (level > 1100 && level < 2100) {
+ return PRESTIGE_ICONS[1].symbol
+ }
+
+ if (level > 2100 && level < 3100) {
+ return PRESTIGE_ICONS[2].symbol
+ }
+
+ return PRESTIGE_ICONS[3].symbol
+}
diff --git a/src/lib/schema/player.ts b/src/lib/schema/player.ts
index a34d82c..34af9eb 100644
--- a/src/lib/schema/player.ts
+++ b/src/lib/schema/player.ts
@@ -13,7 +13,16 @@ export const playerSchema = z.looseObject({
achievementPoints: z.number().optional(),
stats: z.looseObject({
Bedwars: z.looseObject({
- Experience: z.number()
+ Experience: z.number(),
+ winstreak: z.number().optional(),
+ kills_bedwars: z.number().default(0),
+ deaths_bedwars: z.number().default(0),
+ final_kills_bedwars: z.number().default(0),
+ final_deaths_bedwars: z.number().default(0),
+ wins_bedwars: z.number().default(0),
+ losses_bedwars: z.number().default(0),
+ beds_broken_bedwars: z.number().default(0),
+ beds_lost_bedwars: z.number().default(0)
}).optional()
}),
quests: z.record(