Quick change
This commit is contained in:
@@ -1,9 +1,52 @@
|
|||||||
"use client"
|
"use client"
|
||||||
|
|
||||||
|
import { Accordion } from "@/components/ui/accordion"
|
||||||
import { usePathname } from "next/navigation"
|
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() {
|
export function PlayerPageLoadText() {
|
||||||
const path = usePathname()
|
const path = usePathname()
|
||||||
|
|
||||||
return <p>{`Loading stats for ${path.split("/").at(-1)}`}</p>
|
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>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
import DisplayName from "@/components/player/displayname"
|
import DisplayName from "@/components/player/displayname"
|
||||||
import { Accordion } from "@/components/ui/accordion"
|
|
||||||
import { Card, CardContent } from "@/components/ui/card"
|
import { Card, CardContent } from "@/components/ui/card"
|
||||||
import { env } from "@/lib/env/server"
|
import { env } from "@/lib/env/server"
|
||||||
import { getGuild } from "@/lib/hypixel/api/guild"
|
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 { Loader2Icon, ShieldAlert } from "lucide-react"
|
||||||
import { Metadata } from "next"
|
import { Metadata } from "next"
|
||||||
import { Suspense } from "react"
|
import { Suspense } from "react"
|
||||||
import { PlayerPageLoadText } from "./_client"
|
import PlayerStats, { PlayerPageLoadText } from "./_client"
|
||||||
import Sidebar from "./_components/Sidebar"
|
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> {
|
export async function generateMetadata({ params }: { params: Promise<{ ign: string }> }): Promise<Metadata> {
|
||||||
const { ign } = await params
|
const { ign } = await params
|
||||||
@@ -115,28 +101,7 @@ async function SuspendedPage({ params }: Pick<PageProps<"/player/[ign]">, "param
|
|||||||
session={session}
|
session={session}
|
||||||
/>
|
/>
|
||||||
{player.stats !== undefined ?
|
{player.stats !== undefined ?
|
||||||
(
|
<PlayerStats stats={player.stats} achievements={player.achievements} /> :
|
||||||
<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>
|
|
||||||
) :
|
|
||||||
(
|
(
|
||||||
<div className="w-3/4">
|
<div className="w-3/4">
|
||||||
<Card>
|
<Card>
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import "./globals.css"
|
|||||||
|
|
||||||
import { GeistSans as geist } from "geist/font/sans"
|
import { GeistSans as geist } from "geist/font/sans"
|
||||||
|
|
||||||
import ThemeProvider from "@/components/ThemeProvider"
|
import ThemeProvider from "@/components/theme-provider"
|
||||||
import { Toaster } from "@/components/ui/sonner"
|
import { Toaster } from "@/components/ui/sonner"
|
||||||
import type { Metadata } from "next"
|
import type { Metadata } from "next"
|
||||||
|
|
||||||
@@ -18,7 +18,7 @@ export default function RootLayout({ children }: LayoutProps<"/">) {
|
|||||||
<html lang="en" suppressHydrationWarning className={geist.className}>
|
<html lang="en" suppressHydrationWarning className={geist.className}>
|
||||||
<head>
|
<head>
|
||||||
{/* eslint-disable-next-line @next/next/no-sync-scripts */}
|
{/* eslint-disable-next-line @next/next/no-sync-scripts */}
|
||||||
{process.env.NODE_ENV === "development" && <script src="https://unpkg.com/react-scan/dist/auto.global.js" />}
|
{/* {process.env.NODE_ENV === "development" && <script src="https://unpkg.com/react-scan/dist/auto.global.js" />} */}
|
||||||
</head>
|
</head>
|
||||||
<body className="antialiased">
|
<body className="antialiased">
|
||||||
<ThemeProvider>
|
<ThemeProvider>
|
||||||
|
|||||||
Reference in New Issue
Block a user