Implemented guild page
This commit is contained in:
@@ -1,4 +1,9 @@
|
||||
import { getColor } from "@/lib/colors"
|
||||
import { env } from "@/lib/env/server"
|
||||
import { getGuild } from "@/lib/hypixel/api/guild"
|
||||
import { getUuid } from "@/lib/hypixel/api/mojang"
|
||||
import { getPlayer } from "@/lib/hypixel/api/player"
|
||||
import { cn } from "@/lib/utils"
|
||||
import { Loader2Icon, ShieldAlert } from "lucide-react"
|
||||
import { Suspense } from "react"
|
||||
import { GuildPageLoadText } from "./_client"
|
||||
@@ -31,9 +36,43 @@ export default function GuildPage({ params }: PageProps<"/guild/[value]">) {
|
||||
|
||||
async function SuspendedPage({ params }: Pick<PageProps<"/guild/[value]">, "params">) {
|
||||
const { value } = await params
|
||||
|
||||
const mc = await getUuid(value)
|
||||
if (!mc) {
|
||||
return (
|
||||
<div className="flex flex-col items-center min-h-screen">
|
||||
<h1 className="pt-30">Player not found</h1>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
const player = await getPlayer(mc.id)
|
||||
|
||||
if (!player) {
|
||||
return (
|
||||
<div className="flex flex-col items-center min-h-screen">
|
||||
<h1 className="pt-30">Player hasn't joined hypixel</h1>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
const guild = await getGuild(mc.id)
|
||||
|
||||
if (!guild) {
|
||||
return (
|
||||
<div className="flex flex-col items-center min-h-screen">
|
||||
<h1 className="pt-30">Player is not in a guild.</h1>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="flex flex-col items-center pb-5 pt-35">
|
||||
{value}
|
||||
<div className="flex flex-col items-center pb-5 pt-30">
|
||||
<div className="flex gap-2 items-center">
|
||||
<h1 className="text-4xl font-bold sm:text-5xl text-stroke text-stroke-foreground dark:text-stroke-transparent">
|
||||
<span className={cn(getColor(guild.tagColor, "text", "gray"))}>{guild.name}</span>
|
||||
</h1>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user