From d1708a204c481a149a735c68f541a4e38375b2d7 Mon Sep 17 00:00:00 2001 From: Taken Date: Sun, 21 Sep 2025 22:10:13 +0200 Subject: [PATCH] Updated stats --- src/app/(stats)/player/[ign]/_client.tsx | 3 +++ src/app/(stats)/player/[ign]/_stats/arcade/arcade.tsx | 4 ++-- src/app/(stats)/player/[ign]/_stats/bedwars/bedwars.tsx | 4 ++-- src/app/(stats)/player/[ign]/_stats/blitz/blitz.tsx | 4 ++-- .../(stats)/player/[ign]/_stats/build-battle/build-battle.tsx | 4 ++-- src/app/(stats)/player/[ign]/_stats/classic/arenabrawl.tsx | 4 ++-- src/app/(stats)/player/[ign]/_stats/classic/paintball.tsx | 4 ++-- src/app/(stats)/player/[ign]/_stats/classic/vampirez.tsx | 4 ++-- src/app/(stats)/player/[ign]/_stats/classic/walls.tsx | 4 ++-- .../(stats)/player/[ign]/_stats/copsandcrims/copsandcrims.tsx | 4 ++-- src/app/(stats)/player/[ign]/_stats/duels/duels.tsx | 4 ++-- src/app/(stats)/player/[ign]/_stats/megawalls/megawalls.tsx | 4 ++-- .../player/[ign]/_stats/murder-mystery/murder-mystery.tsx | 4 ++-- src/app/(stats)/player/[ign]/_stats/pit/pit.tsx | 4 ++-- src/app/(stats)/player/[ign]/_stats/skywars/skywars.tsx | 4 ++-- src/app/(stats)/player/[ign]/_stats/smashheros/smashheros.tsx | 4 ++-- src/app/(stats)/player/[ign]/_stats/speeduhc/speeduhc.tsx | 4 ++-- src/app/(stats)/player/[ign]/_stats/tnt-games/tnt-games.tsx | 4 ++-- src/app/(stats)/player/[ign]/_stats/uhc/uhc.tsx | 4 ++-- src/app/(stats)/player/[ign]/_stats/warlords/warlords.tsx | 4 ++-- src/app/(stats)/player/[ign]/_stats/woolgames/woolgames.tsx | 4 ++-- 21 files changed, 43 insertions(+), 40 deletions(-) diff --git a/src/app/(stats)/player/[ign]/_client.tsx b/src/app/(stats)/player/[ign]/_client.tsx index 893c00e..acc100e 100644 --- a/src/app/(stats)/player/[ign]/_client.tsx +++ b/src/app/(stats)/player/[ign]/_client.tsx @@ -12,6 +12,7 @@ import { GripVertical } from "lucide-react" import { usePathname } from "next/navigation" import { useEffect, useRef, useState } from "react" +import { useRouter } from "next/navigation" import ArcadeStats from "./_stats/arcade/arcade" import BedwarsStats from "./_stats/bedwars/bedwars" import BlitzStats from "./_stats/blitz/blitz" @@ -117,6 +118,7 @@ export function PlayerStats( const [statsOrder, setStatsOrder] = useState(layout || defaultOrder) const [isClient, setIsClient] = useState(false) + const router = useRouter() const sensors = useSensors( useSensor(PointerSensor), @@ -145,6 +147,7 @@ export function PlayerStats( setStatsOrder(newOrder) updateStatsOrder(newOrder) + router.refresh() } } diff --git a/src/app/(stats)/player/[ign]/_stats/arcade/arcade.tsx b/src/app/(stats)/player/[ign]/_stats/arcade/arcade.tsx index e74b67c..1e00a3d 100644 --- a/src/app/(stats)/player/[ign]/_stats/arcade/arcade.tsx +++ b/src/app/(stats)/player/[ign]/_stats/arcade/arcade.tsx @@ -3,12 +3,12 @@ import { formatNumber } from "@/lib/formatters" import { getArcadeTotalWins } from "@/lib/hypixel/arcade/general" import { NonNullStats } from "@/lib/schema/player" import { BasicStat } from "../../_components/Stats" -import { GeneralStats } from "../stats-components" +import { EmptyStats, GeneralStats } from "../stats-components" import ArcadeOtherStats from "./other" import { ArcadeMiniWallsStats, ArcadePixelPartyStats, ArcadeZombieStats } from "./stats" export default function ArcadeStats({ stats }: { stats: NonNullStats["Arcade"] }) { - if (!stats) return null + if (!stats) return const wins = getArcadeTotalWins(stats) diff --git a/src/app/(stats)/player/[ign]/_stats/bedwars/bedwars.tsx b/src/app/(stats)/player/[ign]/_stats/bedwars/bedwars.tsx index 3b22e41..2da86b6 100644 --- a/src/app/(stats)/player/[ign]/_stats/bedwars/bedwars.tsx +++ b/src/app/(stats)/player/[ign]/_stats/bedwars/bedwars.tsx @@ -3,13 +3,13 @@ import { formatNumber } from "@/lib/formatters" import { getBedwarsLevelForExp, getTotalBedwarsExpForLevel } from "@/lib/hypixel/bedwars/level" import { devide, getProgress } from "@/lib/hypixel/general" import { NonNullStats } from "@/lib/schema/player" -import { GeneralStats } from "../stats-components" +import { EmptyStats, GeneralStats } from "../stats-components" import { BedwarsLevel, BedwarsProgress } from "./components" import BedwarsGeneralStats from "./stats" import BedwarsStatTable from "./table" export default function BedwarsStats({ stats }: { stats: NonNullStats["Bedwars"] }) { - if (!stats) return null + if (!stats) return const kd = formatNumber(devide(stats.kills_bedwars, stats.deaths_bedwars)) const fkd = formatNumber(devide(stats.final_kills_bedwars, stats.final_deaths_bedwars)) diff --git a/src/app/(stats)/player/[ign]/_stats/blitz/blitz.tsx b/src/app/(stats)/player/[ign]/_stats/blitz/blitz.tsx index fd8fa5e..ff53479 100644 --- a/src/app/(stats)/player/[ign]/_stats/blitz/blitz.tsx +++ b/src/app/(stats)/player/[ign]/_stats/blitz/blitz.tsx @@ -4,12 +4,12 @@ import { getBlitzMostPlayedKit } from "@/lib/hypixel/blitz/general" import { devide } from "@/lib/hypixel/general" import { NonNullStats } from "@/lib/schema/player" import { cn } from "@/lib/utils" -import { GeneralStats } from "../stats-components" +import { EmptyStats, GeneralStats } from "../stats-components" import BlitzGeneralStats from "./stats" import { BlitzKitStatsTable, BlitzModeStatsTable } from "./table" export default function BlitzStats({ stats }: { stats: NonNullStats["Blitz"] }) { - if (!stats) return null + if (!stats) return const kd = formatNumber(devide(stats.kills, stats.deaths)) const wins = stats.wins_solo_normal + stats.wins_teams_normal diff --git a/src/app/(stats)/player/[ign]/_stats/build-battle/build-battle.tsx b/src/app/(stats)/player/[ign]/_stats/build-battle/build-battle.tsx index d712461..e48ee34 100644 --- a/src/app/(stats)/player/[ign]/_stats/build-battle/build-battle.tsx +++ b/src/app/(stats)/player/[ign]/_stats/build-battle/build-battle.tsx @@ -3,13 +3,13 @@ import { formatNumber } from "@/lib/formatters" import { getBuildBattleRank } from "@/lib/hypixel/build-battle/general" import { NonNullStats } from "@/lib/schema/player" import { cn } from "@/lib/utils" -import { GeneralStats } from "../stats-components" +import { EmptyStats, GeneralStats } from "../stats-components" import BuildBattleTitleProgress from "./progress" import BuildBattleGeneralStats from "./stats" import BuildBattleStatsTable from "./table" export default function BuildBattleStats({ stats }: { stats: NonNullStats["BuildBattle"] }) { - if (!stats) return null + if (!stats) return const rank = getBuildBattleRank(stats.score) diff --git a/src/app/(stats)/player/[ign]/_stats/classic/arenabrawl.tsx b/src/app/(stats)/player/[ign]/_stats/classic/arenabrawl.tsx index 7321df3..baf3902 100644 --- a/src/app/(stats)/player/[ign]/_stats/classic/arenabrawl.tsx +++ b/src/app/(stats)/player/[ign]/_stats/classic/arenabrawl.tsx @@ -2,12 +2,12 @@ import { Separator } from "@/components/ui/separator" import { formatNumber } from "@/lib/formatters" import { devide } from "@/lib/hypixel/general" import { NonNullStats } from "@/lib/schema/player" -import { GeneralStats } from "../stats-components" +import { EmptyStats, GeneralStats } from "../stats-components" import { ArenaBrawlGeneralStats } from "./stats" import { ArenaBrawlModeStatsTable } from "./table" export default function ArenaBrawlStats({ stats }: { stats: NonNullStats["ArenaBrawl"] }) { - if (!stats) return null + if (!stats) return const kills = stats.kills_1v1 + stats.kills_2v2 + stats.kills_4v4 const deaths = stats.deaths_1v1 + stats.deaths_2v2 + stats.deaths_4v4 diff --git a/src/app/(stats)/player/[ign]/_stats/classic/paintball.tsx b/src/app/(stats)/player/[ign]/_stats/classic/paintball.tsx index a5162b7..0c652b8 100644 --- a/src/app/(stats)/player/[ign]/_stats/classic/paintball.tsx +++ b/src/app/(stats)/player/[ign]/_stats/classic/paintball.tsx @@ -2,11 +2,11 @@ import { Separator } from "@/components/ui/separator" import { formatNumber } from "@/lib/formatters" import { devide } from "@/lib/hypixel/general" import { NonNullStats } from "@/lib/schema/player" -import { GeneralStats } from "../stats-components" +import { EmptyStats, GeneralStats } from "../stats-components" import { PaintballGeneralStats } from "./stats" export default function PaintballStats({ stats }: { stats: NonNullStats["Paintball"] }) { - if (!stats) return null + if (!stats) return const kd = formatNumber(devide(stats.kills, stats.deaths)) diff --git a/src/app/(stats)/player/[ign]/_stats/classic/vampirez.tsx b/src/app/(stats)/player/[ign]/_stats/classic/vampirez.tsx index 9d49c9c..2ca5bc8 100644 --- a/src/app/(stats)/player/[ign]/_stats/classic/vampirez.tsx +++ b/src/app/(stats)/player/[ign]/_stats/classic/vampirez.tsx @@ -2,11 +2,11 @@ import { Separator } from "@/components/ui/separator" import { formatNumber } from "@/lib/formatters" import { devide } from "@/lib/hypixel/general" import { NonNullStats } from "@/lib/schema/player" -import { GeneralStats } from "../stats-components" +import { EmptyStats, GeneralStats } from "../stats-components" import { VampireZGeneralStats } from "./stats" export default function VampireZStats({ stats }: { stats: NonNullStats["VampireZ"] }) { - if (!stats) return null + if (!stats) return const vkd = formatNumber(devide(stats.human_kills, stats.vampire_deaths)) const hkd = formatNumber(devide(stats.vampire_kills, stats.human_deaths)) diff --git a/src/app/(stats)/player/[ign]/_stats/classic/walls.tsx b/src/app/(stats)/player/[ign]/_stats/classic/walls.tsx index 275b5f5..6925a8a 100644 --- a/src/app/(stats)/player/[ign]/_stats/classic/walls.tsx +++ b/src/app/(stats)/player/[ign]/_stats/classic/walls.tsx @@ -2,11 +2,11 @@ import { Separator } from "@/components/ui/separator" import { formatNumber } from "@/lib/formatters" import { devide } from "@/lib/hypixel/general" import { NonNullStats } from "@/lib/schema/player" -import { GeneralStats } from "../stats-components" +import { EmptyStats, GeneralStats } from "../stats-components" import { WallsGeneralStats } from "./stats" export default function WallsStats({ stats }: { stats: NonNullStats["Walls"] }) { - if (!stats) return null + if (!stats) return const kd = formatNumber(devide(stats.kills, stats.deaths)) const wl = formatNumber(devide(stats.wins, stats.losses)) diff --git a/src/app/(stats)/player/[ign]/_stats/copsandcrims/copsandcrims.tsx b/src/app/(stats)/player/[ign]/_stats/copsandcrims/copsandcrims.tsx index 8c64420..ea142c8 100644 --- a/src/app/(stats)/player/[ign]/_stats/copsandcrims/copsandcrims.tsx +++ b/src/app/(stats)/player/[ign]/_stats/copsandcrims/copsandcrims.tsx @@ -3,13 +3,13 @@ import { formatNumber } from "@/lib/formatters" import { getCopsAndCrimsScoreColor } from "@/lib/hypixel/copsandcrims/general" import { devide } from "@/lib/hypixel/general" import { NonNullStats } from "@/lib/schema/player" -import { GeneralStats } from "../stats-components" +import { EmptyStats, GeneralStats } from "../stats-components" import CopsAndCrimsGeneralStats from "./stats" import CopsAndCrimsStatTable from "./table" import CopsAndCrimsWeaponStats from "./weapons" export default function CopsAndCrimsStats({ stats }: { stats: NonNullStats["CopsAndCrims"] }) { - if (!stats) return null + if (!stats) return const kills = stats.kills + stats.kills_deathmatch + stats.kills_gungame const assists = stats.assists + stats.assists_deathmatch + stats.assists_gungame diff --git a/src/app/(stats)/player/[ign]/_stats/duels/duels.tsx b/src/app/(stats)/player/[ign]/_stats/duels/duels.tsx index 2bb05bf..76bd6a1 100644 --- a/src/app/(stats)/player/[ign]/_stats/duels/duels.tsx +++ b/src/app/(stats)/player/[ign]/_stats/duels/duels.tsx @@ -3,12 +3,12 @@ import { formatNumber } from "@/lib/formatters" import { getDuelsAllDivisions, getDuelsMostPlayed } from "@/lib/hypixel/duels/general" import { devide, romanize } from "@/lib/hypixel/general" import { NonNullStats } from "@/lib/schema/player" -import { GeneralStats } from "../stats-components" +import { EmptyStats, GeneralStats } from "../stats-components" import DuelsGeneralStats from "./stats" import DuelsStatsTable from "./table" export default function DuelsStats({ stats }: { stats: NonNullStats["Duels"] }) { - if (!stats) return null + if (!stats) return const wl = formatNumber(devide(stats.wins, stats.losses)) const kd = formatNumber(devide(stats.kills, stats.deaths)) diff --git a/src/app/(stats)/player/[ign]/_stats/megawalls/megawalls.tsx b/src/app/(stats)/player/[ign]/_stats/megawalls/megawalls.tsx index d923562..504811a 100644 --- a/src/app/(stats)/player/[ign]/_stats/megawalls/megawalls.tsx +++ b/src/app/(stats)/player/[ign]/_stats/megawalls/megawalls.tsx @@ -4,12 +4,12 @@ import { devide } from "@/lib/hypixel/general" import { getMegaWallsDifficultyColor, getMegawallsMostPlayed } from "@/lib/hypixel/megawalls/general" import { NonNullStats } from "@/lib/schema/player" import { cn } from "@/lib/utils" -import { GeneralStats } from "../stats-components" +import { EmptyStats, GeneralStats } from "../stats-components" import MegaWallsGeneralStats from "./stats" import { MegaWallsClassesTable, MegaWallsModesTable } from "./table" export default function MegaWallsStats({ stats }: { stats: NonNullStats["MegaWalls"] }) { - if (!stats) return null + if (!stats) return const kd = formatNumber(devide(stats.kills, stats.deaths)) const fkd = formatNumber(devide(stats.final_kills, stats.final_deaths)) diff --git a/src/app/(stats)/player/[ign]/_stats/murder-mystery/murder-mystery.tsx b/src/app/(stats)/player/[ign]/_stats/murder-mystery/murder-mystery.tsx index e10290e..6a6d430 100644 --- a/src/app/(stats)/player/[ign]/_stats/murder-mystery/murder-mystery.tsx +++ b/src/app/(stats)/player/[ign]/_stats/murder-mystery/murder-mystery.tsx @@ -1,13 +1,13 @@ import { Separator } from "@/components/ui/separator" import { formatNumber } from "@/lib/formatters" import { NonNullStats } from "@/lib/schema/player" -import { GeneralStats } from "../stats-components" +import { EmptyStats, GeneralStats } from "../stats-components" import MurderMysteryInfectionStats from "./infection" import MurderMysteryGeneralStats from "./stats" import MurderMysteryStatTable from "./table" export default function MurderMysteryStats({ stats }: { stats: NonNullStats["MurderMystery"] }) { - if (!stats) return null + if (!stats) return return ( const kd = formatNumber(devide(stats.kills, stats.deaths)) const prestige = getPitPrestige(stats) diff --git a/src/app/(stats)/player/[ign]/_stats/skywars/skywars.tsx b/src/app/(stats)/player/[ign]/_stats/skywars/skywars.tsx index 7e3fb83..719bede 100644 --- a/src/app/(stats)/player/[ign]/_stats/skywars/skywars.tsx +++ b/src/app/(stats)/player/[ign]/_stats/skywars/skywars.tsx @@ -3,7 +3,7 @@ import { formatNumber } from "@/lib/formatters" import { devide, getProgress } from "@/lib/hypixel/general" import { getSkywarsLevel, getSkywarsXpForLevel } from "@/lib/hypixel/skywars/level" import { NonNullStats } from "@/lib/schema/player" -import { GeneralStats } from "../stats-components" +import { EmptyStats, GeneralStats } from "../stats-components" import { SkywarsAngelOfDeath, SkywarsHeads, SkywarsLevel, SkywarsProgress, SkywarsShardProgress } from "./components" import SkyWarsGeneralStats from "./stats" import SkywarsStatTable from "./table" @@ -11,7 +11,7 @@ import SkywarsStatTable from "./table" export default function SkyWarsStats( { stats, achievements_skywars_opal_obsession }: { stats: NonNullStats["SkyWars"], achievements_skywars_opal_obsession: number } ) { - if (!stats) return null + if (!stats) return const level = getSkywarsLevel(stats.skywars_experience) const kd = formatNumber(devide(stats.kills, stats.deaths)) diff --git a/src/app/(stats)/player/[ign]/_stats/smashheros/smashheros.tsx b/src/app/(stats)/player/[ign]/_stats/smashheros/smashheros.tsx index cafee37..2671e26 100644 --- a/src/app/(stats)/player/[ign]/_stats/smashheros/smashheros.tsx +++ b/src/app/(stats)/player/[ign]/_stats/smashheros/smashheros.tsx @@ -3,12 +3,12 @@ import { formatNumber } from "@/lib/formatters" import { devide } from "@/lib/hypixel/general" import { getSmashHerosDifficultyColor, getSmashHerosMostPlayedHero } from "@/lib/hypixel/smashhero/general" import { NonNullStats } from "@/lib/schema/player" -import { GeneralStats } from "../stats-components" +import { EmptyStats, GeneralStats } from "../stats-components" import SmashHerosGeneralStats from "./stats" import { SmashHerosHeroTable, SmashHerosModeTable } from "./table" export default function SmashHerosStats({ stats }: { stats: NonNullStats["SmashHeros"] }) { - if (!stats) return null + if (!stats) return const kd = formatNumber(devide(stats.kills, stats.deaths)) const wl = formatNumber(devide(stats.wins, stats.losses)) diff --git a/src/app/(stats)/player/[ign]/_stats/speeduhc/speeduhc.tsx b/src/app/(stats)/player/[ign]/_stats/speeduhc/speeduhc.tsx index 6bf468f..c870f2c 100644 --- a/src/app/(stats)/player/[ign]/_stats/speeduhc/speeduhc.tsx +++ b/src/app/(stats)/player/[ign]/_stats/speeduhc/speeduhc.tsx @@ -3,13 +3,13 @@ import { formatNumber } from "@/lib/formatters" import { devide } from "@/lib/hypixel/general" import { getSpeedUHCStar } from "@/lib/hypixel/speeduhc/general" import { NonNullStats } from "@/lib/schema/player" -import { GeneralStats } from "../stats-components" +import { EmptyStats, GeneralStats } from "../stats-components" import SpeedUHCProgress from "./progress" import SpeedUHCGeneralStats from "./stats" import { SpeedUHCMasteryStatsTable, SpeedUHCModeStatsTable } from "./table" export default function SpeedUHCStats({ stats, uhcCoins }: { stats: NonNullStats["SpeedUHC"], uhcCoins: number | undefined }) { - if (!stats) return null + if (!stats) return const kd = formatNumber(devide(stats.kills, stats.deaths)) const wl = formatNumber(devide(stats.wins, stats.losses)) diff --git a/src/app/(stats)/player/[ign]/_stats/tnt-games/tnt-games.tsx b/src/app/(stats)/player/[ign]/_stats/tnt-games/tnt-games.tsx index 8e84251..936b348 100644 --- a/src/app/(stats)/player/[ign]/_stats/tnt-games/tnt-games.tsx +++ b/src/app/(stats)/player/[ign]/_stats/tnt-games/tnt-games.tsx @@ -1,11 +1,11 @@ import { Separator } from "@/components/ui/separator" import { NonNullStats } from "@/lib/schema/player" -import { GeneralStats } from "../stats-components" +import { EmptyStats, GeneralStats } from "../stats-components" import TNTGamesGeneralStats from "./stats" import TNTGamesWizardsStats from "./wizards" export default function TNTGamesStats({ stats }: { stats: NonNullStats["TNTGames"] }) { - if (!stats) return null + if (!stats) return return ( const combined = getUHCStatsCombined(stats) const kd = formatNumber(devide(combined.kills, combined.deaths)) diff --git a/src/app/(stats)/player/[ign]/_stats/warlords/warlords.tsx b/src/app/(stats)/player/[ign]/_stats/warlords/warlords.tsx index ed326e5..2685f09 100644 --- a/src/app/(stats)/player/[ign]/_stats/warlords/warlords.tsx +++ b/src/app/(stats)/player/[ign]/_stats/warlords/warlords.tsx @@ -3,14 +3,14 @@ import { formatNumber } from "@/lib/formatters" import { devide } from "@/lib/hypixel/general" import { getWarlordsLosses, getWarlordsMostPlayedClass } from "@/lib/hypixel/warlords/general" import { NonNullStats } from "@/lib/schema/player" -import { GeneralStats } from "../stats-components" +import { EmptyStats, GeneralStats } from "../stats-components" import { WarlordsWeaponsBar } from "./client" import WarlordsGeneralStats from "./stats" import { WarlordsClassStatsTable, WarlordsModeStatsTable } from "./table" import WarlordsWeaponsList from "./weapons" export default function WarlordsStats({ stats }: { stats: NonNullStats["Warlords"] }) { - if (!stats) return null + if (!stats) return const losses = getWarlordsLosses(stats) const kd = formatNumber(devide(stats.kills, stats.deaths)) diff --git a/src/app/(stats)/player/[ign]/_stats/woolgames/woolgames.tsx b/src/app/(stats)/player/[ign]/_stats/woolgames/woolgames.tsx index b939e31..608dfdd 100644 --- a/src/app/(stats)/player/[ign]/_stats/woolgames/woolgames.tsx +++ b/src/app/(stats)/player/[ign]/_stats/woolgames/woolgames.tsx @@ -3,14 +3,14 @@ import { formatNumber } from "@/lib/formatters" import { getWoolGamesLevel, getWoolGamesPrestige, getWoolGamesPretigeIcon } from "@/lib/hypixel/woolgames/general" import { NonNullStats } from "@/lib/schema/player" import Multicolored from "../../_components/Multicolored" -import { GeneralStats } from "../stats-components" +import { EmptyStats, GeneralStats } from "../stats-components" import { WoolGamesCaptureTheWool, WoolGamesSheepWars, WoolGamesWoolWars } from "./modes" import WoolGamesProgress from "./progress" import WoolGamesGeneralStats from "./stats" import WoolGamesWoolWarsStatTable from "./table" export default function WoolGamesStats({ stats }: { stats: NonNullStats["WoolGames"] }) { - if (!stats) return null + if (!stats) return const level = getWoolGamesLevel(stats.progression?.experience) const icon = getWoolGamesPretigeIcon(stats.wool_wars_prestige_icon)