add motd to the server page
All checks were successful
Deploy App / docker (ubuntu-latest) (push) Successful in 56s
All checks were successful
Deploy App / docker (ubuntu-latest) (push) Successful in 56s
This commit is contained in:
@ -34,7 +34,7 @@ export default function RootLayout({
|
||||
children,
|
||||
}: Readonly<{
|
||||
children: React.ReactNode;
|
||||
}>) {
|
||||
}>): JSX.Element {
|
||||
return (
|
||||
<>
|
||||
<html className={Fonts.inter.className} lang="en" suppressHydrationWarning>
|
||||
|
@ -10,7 +10,7 @@ const buttons: Button[] = [
|
||||
{ title: "Documentation", url: "https://api.mcutils.xyz/swagger-ui.html" },
|
||||
];
|
||||
|
||||
export default function Home() {
|
||||
export default function Home(): JSX.Element {
|
||||
return (
|
||||
<div className="text-center flex flex-col justify-center">
|
||||
<h1 className="text-4xl mb-2">Minecraft Utilities</h1>
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { Card } from "@/app/components/card";
|
||||
import { NotFound } from "@/app/components/not-found";
|
||||
import { LookupPlayer } from "@/app/components/player/lookup-player";
|
||||
import { Card } from "@/app/components/ui/card";
|
||||
import { generateEmbed } from "@/common/embed";
|
||||
import { getPlayer } from "mcutils-library";
|
||||
import { Player } from "mcutils-library/dist/types/player/player";
|
||||
@ -42,7 +42,7 @@ async function getData(id: string): Promise<Player | null> {
|
||||
}
|
||||
}
|
||||
|
||||
export default async function Page({ params }: Params) {
|
||||
export default async function Page({ params }: Params): Promise<JSX.Element> {
|
||||
const player = await getData(params.id);
|
||||
|
||||
return (
|
||||
@ -57,7 +57,7 @@ export default async function Page({ params }: Params) {
|
||||
<Card>
|
||||
{player == null && <NotFound message="Invalid UUID / Username" />}
|
||||
{player != null && (
|
||||
<div className="flex gap-2 flex-col md:flex-row">
|
||||
<div className="flex gap-4 flex-col md:flex-row">
|
||||
<div className="flex justify-center md:justify-start">
|
||||
<Image
|
||||
className="w-[96px] h-[96px]"
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { Card } from "@/app/components/card";
|
||||
import { NotFound } from "@/app/components/not-found";
|
||||
import { LookupServer } from "@/app/components/server/lookup-server";
|
||||
import { Card } from "@/app/components/ui/card";
|
||||
import { generateEmbed } from "@/common/embed";
|
||||
import { capitalizeFirstLetter } from "@/common/string-utils";
|
||||
import { getServer } from "mcutils-library";
|
||||
@ -54,7 +54,7 @@ async function getData(platform: ServerPlatform, id: string): Promise<MinecraftS
|
||||
}
|
||||
}
|
||||
|
||||
export default async function Page({ params: { platform, hostname } }: Params) {
|
||||
export default async function Page({ params: { platform, hostname } }: Params): Promise<JSX.Element> {
|
||||
const server = await getData(platform, hostname);
|
||||
|
||||
let favicon = null; // Server favicon
|
||||
@ -77,28 +77,36 @@ export default async function Page({ params: { platform, hostname } }: Params) {
|
||||
<Card>
|
||||
{server == null && <NotFound message="Server not responding" />}
|
||||
{server != null && (
|
||||
<div className="flex gap-2 flex-col md:flex-row">
|
||||
{favicon && (
|
||||
<div className="flex justify-center md:justify-start">
|
||||
<Image
|
||||
className="w-[96px] h-[96px]"
|
||||
src={favicon}
|
||||
width={96}
|
||||
height={96}
|
||||
quality={100}
|
||||
alt="The server's favicon"
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
<div className="flex gap-4 flex-col">
|
||||
<div className="flex gap-4 flex-col md:flex-row">
|
||||
{favicon && (
|
||||
<div className="flex justify-center md:justify-start">
|
||||
<Image
|
||||
className="w-[64px] h-[64px]"
|
||||
src={favicon}
|
||||
width={64}
|
||||
height={64}
|
||||
quality={100}
|
||||
alt="The server's favicon"
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div className="flex flex-col">
|
||||
<h2 className="text-xl">{server.hostname}</h2>
|
||||
<div className="text-gray-300">
|
||||
<p>
|
||||
Players online: {server.players.online}/{server.players.max}
|
||||
</p>
|
||||
<div className="flex flex-col">
|
||||
<h2 className="text-xl">{server.hostname}</h2>
|
||||
<div className="text-gray-300">
|
||||
<p>
|
||||
Players online: {server.players.online}/{server.players.max}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="bg-background rounded-lg p-2">
|
||||
{server.motd.html.map((line, index) => {
|
||||
return <p key={index} dangerouslySetInnerHTML={{ __html: line }}></p>;
|
||||
})}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</Card>
|
||||
|
Reference in New Issue
Block a user