Quick change

This commit is contained in:
2025-09-15 15:33:34 +02:00
parent 4d3956b1ee
commit fb32ef95e7
4 changed files with 47 additions and 39 deletions

View File

@@ -1,9 +1,52 @@
"use client"
import { Accordion } from "@/components/ui/accordion"
import { usePathname } from "next/navigation"
import { Player } from "@/lib/schema/player"
import ArcadeStats from "./_stats/arcade/arcade"
import BedwarsStats from "./_stats/bedwars/bedwars"
import BlitzStats from "./_stats/blitz/blitz"
import BuildBattleStats from "./_stats/build-battle/build-battle"
import CopsAndCrimsStats from "./_stats/copsandcrims/copsandcrims"
import DuelsStats from "./_stats/duels/duels"
import MegaWallsStats from "./_stats/megawalls/megawalls"
import MurderMysteryStats from "./_stats/murder-mystery/murder-mystery"
import PitStats from "./_stats/pit/pit"
import SkyWarsStats from "./_stats/skywars/skywars"
import TNTGamesStats from "./_stats/tnt-games/tnt-games"
import UHCStats from "./_stats/uhc/uhc"
import WoolGamesStats from "./_stats/woolgames/woolgames"
export function PlayerPageLoadText() {
const path = usePathname()
return <p>{`Loading stats for ${path.split("/").at(-1)}`}</p>
}
export default function PlayerStats(
{ stats, achievements }: { stats: NonNullable<Player["player"]["stats"]>, achievements: Player["player"]["achievements"] }
) {
return (
<div className="w-full md:w-3/4">
<Accordion type="multiple" className="space-y-4">
<BedwarsStats stats={stats.Bedwars} />
<SkyWarsStats
stats={stats.SkyWars}
achievements_skywars_opal_obsession={achievements?.["skywars_opal_obsession"] ?? 0}
/>
<DuelsStats stats={stats.Duels} />
<MurderMysteryStats stats={stats.MurderMystery} />
<BuildBattleStats stats={stats.BuildBattle} />
<UHCStats stats={stats.UHC} />
<PitStats stats={stats.Pit} />
<TNTGamesStats stats={stats.TNTGames} />
<MegaWallsStats stats={stats.MegaWalls} />
<CopsAndCrimsStats stats={stats.CopsAndCrims} />
<WoolGamesStats stats={stats.WoolGames} />
<BlitzStats stats={stats.Blitz} />
<ArcadeStats stats={stats.Arcade} />
</Accordion>
</div>
)
}

View File

@@ -1,5 +1,4 @@
import DisplayName from "@/components/player/displayname"
import { Accordion } from "@/components/ui/accordion"
import { Card, CardContent } from "@/components/ui/card"
import { env } from "@/lib/env/server"
import { getGuild } from "@/lib/hypixel/api/guild"
@@ -10,21 +9,8 @@ import { getExactLevel } from "@/lib/hypixel/general/level"
import { Loader2Icon, ShieldAlert } from "lucide-react"
import { Metadata } from "next"
import { Suspense } from "react"
import { PlayerPageLoadText } from "./_client"
import PlayerStats, { PlayerPageLoadText } from "./_client"
import Sidebar from "./_components/Sidebar"
import ArcadeStats from "./_stats/arcade/arcade"
import BedwarsStats from "./_stats/bedwars/bedwars"
import BlitzStats from "./_stats/blitz/blitz"
import BuildBattleStats from "./_stats/build-battle/build-battle"
import CopsAndCrimsStats from "./_stats/copsandcrims/copsandcrims"
import DuelsStats from "./_stats/duels/duels"
import MegaWallsStats from "./_stats/megawalls/megawalls"
import MurderMysteryStats from "./_stats/murder-mystery/murder-mystery"
import PitStats from "./_stats/pit/pit"
import SkyWarsStats from "./_stats/skywars/skywars"
import TNTGamesStats from "./_stats/tnt-games/tnt-games"
import UHCStats from "./_stats/uhc/uhc"
import WoolGamesStats from "./_stats/woolgames/woolgames"
export async function generateMetadata({ params }: { params: Promise<{ ign: string }> }): Promise<Metadata> {
const { ign } = await params
@@ -115,28 +101,7 @@ async function SuspendedPage({ params }: Pick<PageProps<"/player/[ign]">, "param
session={session}
/>
{player.stats !== undefined ?
(
<div className="w-full md:w-3/4">
<Accordion type="multiple" className="space-y-4">
<BedwarsStats stats={player.stats.Bedwars} />
<SkyWarsStats
stats={player.stats.SkyWars}
achievements_skywars_opal_obsession={player.achievements?.["skywars_opal_obsession"] ?? 0}
/>
<DuelsStats stats={player.stats.Duels} />
<MurderMysteryStats stats={player.stats.MurderMystery} />
<BuildBattleStats stats={player.stats.BuildBattle} />
<UHCStats stats={player.stats.UHC} />
<PitStats stats={player.stats.Pit} />
<TNTGamesStats stats={player.stats.TNTGames} />
<MegaWallsStats stats={player.stats.MegaWalls} />
<CopsAndCrimsStats stats={player.stats.CopsAndCrims} />
<WoolGamesStats stats={player.stats.WoolGames} />
<BlitzStats stats={player.stats.Blitz} />
<ArcadeStats stats={player.stats.Arcade} />
</Accordion>
</div>
) :
<PlayerStats stats={player.stats} achievements={player.achievements} /> :
(
<div className="w-3/4">
<Card>