From 2c80edb56a2c54d8868cbe698a10243f318ed11b Mon Sep 17 00:00:00 2001 From: Liam Date: Thu, 18 Apr 2024 09:11:19 +0100 Subject: [PATCH] move json button and add json button to the server page --- src/app/components/code-highlighter.tsx | 1 - src/app/components/player/player-view.tsx | 64 +++++++++++----------- src/app/components/server/server-view.tsx | 67 ++++++++++++++--------- 3 files changed, 72 insertions(+), 60 deletions(-) diff --git a/src/app/components/code-highlighter.tsx b/src/app/components/code-highlighter.tsx index c40e180..ec0b246 100644 --- a/src/app/components/code-highlighter.tsx +++ b/src/app/components/code-highlighter.tsx @@ -23,7 +23,6 @@ export function CodeHighlighter({ code, rounded = true }: CodeHighlighterProps): customStyle={{ maxHeight: "600px", backgroundColor: "hsl(var(--popover))", - overflow: "hidden", wordBreak: "break-all", borderRadius: rounded ? "0.75rem" : undefined, }} diff --git a/src/app/components/player/player-view.tsx b/src/app/components/player/player-view.tsx index 0cd64b0..1018af0 100644 --- a/src/app/components/player/player-view.tsx +++ b/src/app/components/player/player-view.tsx @@ -3,6 +3,7 @@ import { CachedPlayer, SkinPart } from "mcutils-library"; import { ReactElement } from "react"; import { Card } from "../card"; import { CodeDialog } from "../code-dialog"; +import { Button } from "../ui/button"; import { Separator } from "../ui/separator"; import { SkinPartImage } from "./skin-part-image"; @@ -15,44 +16,43 @@ type PlayerViewProps = { export function PlayerView({ player }: PlayerViewProps): ReactElement { return ( - -
-
- - - -
- -
- -
- -
-
-

{player.username}

-

{player.uniqueId}

+
+ +
+
+
- -
-

Skin Parts

-
- {Object.entries(player.skin.parts) - .filter(([part]) => part !== SkinPart.HEAD) // Don't show the head part again - .map(([part, url]) => { - return ; - })} +
+

{player.username}

+

{player.uniqueId}

+
+ + + +
+

Skin Parts

+
+ {Object.entries(player.skin.parts) + .filter(([part]) => part !== SkinPart.HEAD) // Don't show the head part again + .map(([part, url]) => { + return ; + })} +
+ +
+ + +
- +
); } diff --git a/src/app/components/server/server-view.tsx b/src/app/components/server/server-view.tsx index 62a8d4a..aa219a7 100644 --- a/src/app/components/server/server-view.tsx +++ b/src/app/components/server/server-view.tsx @@ -3,6 +3,8 @@ import { CachedBedrockMinecraftServer, CachedJavaMinecraftServer } from "mcutils import Image from "next/image"; import { ReactElement } from "react"; import { Card } from "../card"; +import { CodeDialog } from "../code-dialog"; +import { Button } from "../ui/button"; type ServerViewProps = { /** @@ -18,38 +20,49 @@ type ServerViewProps = { export function ServerView({ server, favicon }: ServerViewProps): ReactElement { return ( - -
-
- {favicon && ( -
- The server's favicon -
- )} +
+ +
+
+ {favicon && ( +
+ The server's favicon +
+ )} -
-

{server.hostname}

-
-

- Players online: {formatNumber(server.players.online)}/{formatNumber(server.players.max)} -

+
+

{server.hostname}

+
+

+ Players online: {formatNumber(server.players.online)}/{formatNumber(server.players.max)} +

+
-
-
- {server.motd.html.map((line, index) => { - return

; - })} +
+ {server.motd.html.map((line, index) => { + return

; + })} +
+ +
+ + +
- +
); }