recode most things - still wip
All checks were successful
Deploy App / docker (ubuntu-latest) (push) Successful in 2m0s

This commit is contained in:
Lee
2024-04-16 17:54:22 +01:00
parent c054a31008
commit 59acc3a7db
13 changed files with 205 additions and 209 deletions

View File

@ -0,0 +1,46 @@
import { NotFound } from "@/components/not-found";
import { Card } from "@/components/ui/card";
import { getPlayer } from "mcutils-library";
import { Player } from "mcutils-library/dist/types/player/player";
import { Metadata } from "next";
export const metadata: Metadata = {
title: "Lookup Player",
};
async function getData(id: string): Promise<Player | null> {
try {
const cachedPlayer = await getPlayer(id);
return cachedPlayer.player;
} catch (error) {
return null; // Player not found
}
}
type Params = {
params: {
id: string;
};
};
export default async function Page({ params }: Params) {
const player = await getData(params.id);
return (
<div className="h-full flex flex-col items-center">
<div className="mb-4 text-center">
<h1 className="text-xl">Lookup a Player</h1>
<p>You can enter a players uuid or username to get information about the player.</p>
</div>
<Card>
{player == null && <NotFound message="Player not found" />}
{player != null && (
<div className="flex flex-col items-center gap-2">
<p>Username: {player.username}</p>
</div>
)}
</Card>
</div>
);
}