diff --git a/src/app/(stats)/guild/[value]/_client.tsx b/src/app/(stats)/guild/[value]/_client.tsx index 139bfb8..59a2f62 100644 --- a/src/app/(stats)/guild/[value]/_client.tsx +++ b/src/app/(stats)/guild/[value]/_client.tsx @@ -5,5 +5,5 @@ import { usePathname } from "next/navigation" export function GuildPageLoadText() { const path = usePathname() - return

{`Loading guild stats for ${path.split("/").at(-1)}`}

+ return

{`Loading ${path.split("/").at(-1)}'s guild...`}

} diff --git a/src/app/(stats)/guild/[value]/page.tsx b/src/app/(stats)/guild/[value]/page.tsx index ec01c40..12105b3 100644 --- a/src/app/(stats)/guild/[value]/page.tsx +++ b/src/app/(stats)/guild/[value]/page.tsx @@ -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, "params">) { const { value } = await params + + const mc = await getUuid(value) + if (!mc) { + return ( +
+

Player not found

+
+ ) + } + + const player = await getPlayer(mc.id) + + if (!player) { + return ( +
+

Player hasn't joined hypixel

+
+ ) + } + + const guild = await getGuild(mc.id) + + if (!guild) { + return ( +
+

Player is not in a guild.

+
+ ) + } + return ( -
- {value} +
+
+

+ {guild.name} +

+
) } diff --git a/src/app/(stats)/player/[ign]/page.tsx b/src/app/(stats)/player/[ign]/page.tsx index d8aff39..4315909 100644 --- a/src/app/(stats)/player/[ign]/page.tsx +++ b/src/app/(stats)/player/[ign]/page.tsx @@ -18,7 +18,7 @@ import Sidebar from "./_components/Sidebar" export async function generateMetadata({ params }: { params: Promise<{ ign: string }> }): Promise { const { ign } = await params const user = await getUuid(ign) - return { title: user !== null ? user.name : "Player not found" } + return { title: user !== null ? `${user.name}'s Stats` : "Player not found" } } export default function PlayerPage({ params }: PageProps<"/player/[ign]">) {