Updated stats
This commit is contained in:
@@ -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<string[]>(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()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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 <EmptyStats title="Arcade" />
|
||||
|
||||
const wins = getArcadeTotalWins(stats)
|
||||
|
||||
|
||||
@@ -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 <EmptyStats title="BedWars" />
|
||||
|
||||
const kd = formatNumber(devide(stats.kills_bedwars, stats.deaths_bedwars))
|
||||
const fkd = formatNumber(devide(stats.final_kills_bedwars, stats.final_deaths_bedwars))
|
||||
|
||||
@@ -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 <EmptyStats title="Blitz SG" />
|
||||
|
||||
const kd = formatNumber(devide(stats.kills, stats.deaths))
|
||||
const wins = stats.wins_solo_normal + stats.wins_teams_normal
|
||||
|
||||
@@ -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 <EmptyStats title="Build Battle" />
|
||||
|
||||
const rank = getBuildBattleRank(stats.score)
|
||||
|
||||
|
||||
@@ -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 <EmptyStats title="Arena Brawl" />
|
||||
|
||||
const kills = stats.kills_1v1 + stats.kills_2v2 + stats.kills_4v4
|
||||
const deaths = stats.deaths_1v1 + stats.deaths_2v2 + stats.deaths_4v4
|
||||
|
||||
@@ -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 <EmptyStats title="Paintball" />
|
||||
|
||||
const kd = formatNumber(devide(stats.kills, stats.deaths))
|
||||
|
||||
|
||||
@@ -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 <EmptyStats title="VampireZ" />
|
||||
|
||||
const vkd = formatNumber(devide(stats.human_kills, stats.vampire_deaths))
|
||||
const hkd = formatNumber(devide(stats.vampire_kills, stats.human_deaths))
|
||||
|
||||
@@ -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 <EmptyStats title="Walls" />
|
||||
|
||||
const kd = formatNumber(devide(stats.kills, stats.deaths))
|
||||
const wl = formatNumber(devide(stats.wins, stats.losses))
|
||||
|
||||
@@ -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 <EmptyStats title="Cops And Crims" />
|
||||
|
||||
const kills = stats.kills + stats.kills_deathmatch + stats.kills_gungame
|
||||
const assists = stats.assists + stats.assists_deathmatch + stats.assists_gungame
|
||||
|
||||
@@ -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 <EmptyStats title="Duels" />
|
||||
|
||||
const wl = formatNumber(devide(stats.wins, stats.losses))
|
||||
const kd = formatNumber(devide(stats.kills, stats.deaths))
|
||||
|
||||
@@ -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 <EmptyStats title="Mega Walls" />
|
||||
|
||||
const kd = formatNumber(devide(stats.kills, stats.deaths))
|
||||
const fkd = formatNumber(devide(stats.final_kills, stats.final_deaths))
|
||||
|
||||
@@ -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 <EmptyStats title="Murder Mystery" />
|
||||
|
||||
return (
|
||||
<GeneralStats
|
||||
|
||||
@@ -3,13 +3,13 @@ import { formatNumber } from "@/lib/formatters"
|
||||
import { devide } from "@/lib/hypixel/general"
|
||||
import { getPitPrestige } from "@/lib/hypixel/pit/general"
|
||||
import { NonNullStats } from "@/lib/schema/player"
|
||||
import { GeneralStats } from "../stats-components"
|
||||
import { EmptyStats, GeneralStats } from "../stats-components"
|
||||
import PitLevel from "./level"
|
||||
import PitProgress from "./progress"
|
||||
import PitGeneralStats from "./stats"
|
||||
|
||||
export default function PitStats({ stats }: { stats: NonNullStats["Pit"] }) {
|
||||
if (!stats) return null
|
||||
if (!stats) return <EmptyStats title="Pit" />
|
||||
|
||||
const kd = formatNumber(devide(stats.kills, stats.deaths))
|
||||
const prestige = getPitPrestige(stats)
|
||||
|
||||
@@ -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 <EmptyStats title="SkyWars" />
|
||||
|
||||
const level = getSkywarsLevel(stats.skywars_experience)
|
||||
const kd = formatNumber(devide(stats.kills, stats.deaths))
|
||||
|
||||
@@ -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 <EmptyStats title="Smash Heros" />
|
||||
|
||||
const kd = formatNumber(devide(stats.kills, stats.deaths))
|
||||
const wl = formatNumber(devide(stats.wins, stats.losses))
|
||||
|
||||
@@ -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 <EmptyStats title="Speed UHC" />
|
||||
|
||||
const kd = formatNumber(devide(stats.kills, stats.deaths))
|
||||
const wl = formatNumber(devide(stats.wins, stats.losses))
|
||||
|
||||
@@ -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 <EmptyStats title="TNT Games" />
|
||||
|
||||
return (
|
||||
<GeneralStats
|
||||
|
||||
@@ -4,13 +4,13 @@ import { devide } from "@/lib/hypixel/general"
|
||||
import { getUHCStatsCombined } from "@/lib/hypixel/uhc/general"
|
||||
import { getUhcStarValue } from "@/lib/hypixel/uhc/level"
|
||||
import { NonNullStats } from "@/lib/schema/player"
|
||||
import { GeneralStats } from "../stats-components"
|
||||
import { EmptyStats, GeneralStats } from "../stats-components"
|
||||
import UHCProgress from "./progress"
|
||||
import UHCGeneralStats from "./stats"
|
||||
import UHCStatTable from "./table"
|
||||
|
||||
export default function UHCStats({ stats }: { stats: NonNullStats["UHC"] }) {
|
||||
if (!stats) return null
|
||||
if (!stats) return <EmptyStats title="UHC" />
|
||||
|
||||
const combined = getUHCStatsCombined(stats)
|
||||
const kd = formatNumber(devide(combined.kills, combined.deaths))
|
||||
|
||||
@@ -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 <EmptyStats title="Warlords" />
|
||||
|
||||
const losses = getWarlordsLosses(stats)
|
||||
const kd = formatNumber(devide(stats.kills, stats.deaths))
|
||||
|
||||
@@ -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 <EmptyStats title="Wool Games" />
|
||||
|
||||
const level = getWoolGamesLevel(stats.progression?.experience)
|
||||
const icon = getWoolGamesPretigeIcon(stats.wool_wars_prestige_icon)
|
||||
|
||||
Reference in New Issue
Block a user