import CopyButton from "@/components/copy-button"; import { Badge } from "@/components/ui/badge"; import { ContextMenu, ContextMenuContent, ContextMenuItem, ContextMenuTrigger, } from "@/components/ui/context-menu"; import config from "@/config"; import Image from "next/image"; import Link from "next/link"; import { ReactElement } from "react"; import { CachedPlayer, SkinPart } from "restfulmc-lib"; /** * 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;