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:
@ -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