import Image from "next/image"; import Link from "next/link"; import { CachedPlayer, SkinPart } from "restfulmc-lib"; import { ReactElement } from "react"; import { Badge } from "@/components/ui/badge"; import config from "@/config"; import { ContextMenu, ContextMenuContent, ContextMenuItem, ContextMenuTrigger, } from "@/components/ui/context-menu"; import CopyButton from "@/components/copy-button"; /** * The props for a player result. */ type PlayerResultProps = { /** * The original query to lookup this player. */ query: string | undefined; /** * The result of a search. */ player: CachedPlayer; }; /** * The result of a player search. * * @param player the player to display * @returns the player result jsx */ const PlayerResult = ({ query, player: { uniqueId, username, skin: { parts }, legacy, }, }: PlayerResultProps): ReactElement => (
{/* Raw Json */}
Raw Json
{/* Details */}
{/* Player Head */} {`${username}'s {/* Name, Unique ID, and Badges */}

{username}

{uniqueId} {/* Legacy Badge */} {legacy && (

Legacy

)}
{/* Skin Parts */}
{/* Header */}

Skin Parts

{/* Skin Parts */}
{Object.entries(parts) .filter( ([part]) => part === SkinPart.HEAD || part === SkinPart.FACE || part === SkinPart.BODY_FLAT ) .map(([part, url], index) => ( {`${username}'s ))}
Copy Player Username Copy Player UUID Copy Share URL
); export default PlayerResult;