diff --git a/src/app/player/[id]/page.tsx b/src/app/player/[id]/page.tsx index 6cf1f54..fb644ff 100644 --- a/src/app/player/[id]/page.tsx +++ b/src/app/player/[id]/page.tsx @@ -1,4 +1,5 @@ import { generateEmbed } from "@/common/embed"; +import { LookupPlayer } from "@/components/lookup-player"; import { NotFound } from "@/components/not-found"; import { Card } from "@/components/ui/card"; import { getPlayer } from "mcutils-library"; @@ -49,6 +50,8 @@ export default async function Page({ params }: Params) {

Lookup a Player

You can enter a players uuid or username to get information about the player.

+ +
diff --git a/src/components/lookup-player.tsx b/src/components/lookup-player.tsx new file mode 100644 index 0000000..80cad90 --- /dev/null +++ b/src/components/lookup-player.tsx @@ -0,0 +1,37 @@ +"use client"; + +import { useRouter } from "next/navigation"; +import { useState } from "react"; +import { Button } from "./ui/button"; +import { Input } from "./ui/input"; + +export function LookupPlayer() { + const router = useRouter(); + const [player, setPlayer] = useState(""); + + /** + * Set the player value + * + * @param event the input event + */ + const setPlayerValue = (event: React.ChangeEvent) => { + setPlayer(event.target.value); + }; + + /** + * Lookup a player + */ + const lookupPlayer = () => { + if (!player || player.length === 0) { + return; + } + router.push(`/player/${player}`); + }; + + return ( +
+ + +
+ ); +}