Finished sidebar
This commit is contained in:
63
src/app/(stats)/player/[ign]/page.tsx
Normal file
63
src/app/(stats)/player/[ign]/page.tsx
Normal file
@@ -0,0 +1,63 @@
|
||||
import DisplayName from "@/components/player/displayname"
|
||||
import { getGuild } from "@/lib/hypixel/api/guild"
|
||||
import { getUuid } from "@/lib/hypixel/api/mojang"
|
||||
import { getPlayer } from "@/lib/hypixel/api/player"
|
||||
import { getExactLevel } from "@/lib/hypixel/level"
|
||||
import Sidebar from "./_components/Sidebar"
|
||||
|
||||
export default async function PlayerPage({
|
||||
params
|
||||
}: {
|
||||
params: Promise<{ ign: string }>
|
||||
}) {
|
||||
const { ign: pign } = await params
|
||||
|
||||
const uuid = await getUuid(pign)
|
||||
if (!uuid) {
|
||||
return (
|
||||
<div className="flex flex-col items-center min-h-screen">
|
||||
<h1 className="mt-25">Player not found</h1>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
const player = await getPlayer(uuid)
|
||||
|
||||
if (!player) {
|
||||
return (
|
||||
<div className="flex flex-col items-center min-h-screen">
|
||||
<h1 className="mt-25">Player not found</h1>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
const guild = await getGuild(uuid)
|
||||
|
||||
const level = getExactLevel(player.networkExp)
|
||||
|
||||
return (
|
||||
<div className="flex flex-col items-center min-h-screen">
|
||||
<h1 className="text-3xl font-bold mt-25">
|
||||
<DisplayName
|
||||
ign={player.displayname}
|
||||
rank={player.newPackageRank}
|
||||
monthly={player.monthlyPackageRank}
|
||||
rankColor={player.monthlyRankColor}
|
||||
plusColor={player.rankPlusColor}
|
||||
guildTag={guild?.tag}
|
||||
tagColor={guild?.tagColor}
|
||||
/>
|
||||
</h1>
|
||||
<h1>
|
||||
{player.uuid}
|
||||
</h1>
|
||||
<div className="flex gap-6 px-6 mt-8 w-full max-w-7xl">
|
||||
<Sidebar level={level} ign={pign} player={player} guild={guild ?? undefined} />
|
||||
<div className="p-6 w-3/4 rounded-xl border shadow-sm bg-card">
|
||||
<h2 className="mb-4 text-xl font-semibold">Game Statistics</h2>
|
||||
<p>Game stats will be displayed here...</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user