add toasts for invalid player and invalid server
All checks were successful
Deploy App / docker (ubuntu-latest) (push) Successful in 1m18s

This commit is contained in:
Lee
2024-04-17 18:26:53 +01:00
parent 347ee00c18
commit 6b96c3aedb
11 changed files with 537 additions and 42 deletions

View File

@ -2,6 +2,7 @@
import { Card } from "@/app/components/card";
import { ErrorCard } from "@/app/components/error-card";
import { LookupPlayer } from "@/app/components/player/lookup-player";
import { Separator } from "@/app/components/ui/separator";
import { Tooltip, TooltipContent, TooltipTrigger } from "@/app/components/ui/tooltip";
import { generateEmbed } from "@/common/embed";
import { CachedPlayer, McUtilsAPIError, SkinPart, getPlayer } from "mcutils-library";
@ -80,14 +81,16 @@ export default async function Page({ params: { id } }: Params): Promise<JSX.Elem
/>
</div>
<div className="flex flex-col gap-2 divide-y">
<div className="flex flex-col gap-2">
<div>
<h2 className="text-xl text-primary">{player.username}</h2>
<h2 className="text-xl text-primary font-semibold">{player.username}</h2>
<p>{player.uniqueId}</p>
</div>
<Separator />
<div className="flex flex-col gap-2">
<p className="text-lg mt-2">Skin Parts</p>
<p className="text-lg">Skin Parts</p>
<div className="flex gap-2">
{Object.entries(player.skin.parts)
.filter(([part]) => part !== SkinPart.HEAD) // Don't show the head part again

View File

@ -119,7 +119,7 @@ export default async function Page({ params: { platform, hostname } }: Params):
{error && <ErrorCard message={error} />}
{server != null && (
<Card className="w-max xs:w-fit">
<div className="flex gap-4 flex-col">
<div className="flex gap-2 flex-col">
<div className="flex gap-4 flex-col xs:flex-row">
{favicon && (
<div className="flex justify-center xs:justify-start">
@ -135,7 +135,7 @@ export default async function Page({ params: { platform, hostname } }: Params):
)}
<div className="flex flex-col">
<h2 className="text-xl text-primary">{server.hostname}</h2>
<h2 className="text-xl text-primary font-semibold">{server.hostname}</h2>
<div>
<p>
Players online: {formatNumber(server.players.online)}/{formatNumber(server.players.max)}