add realtime statistics!!!
Some checks failed
Deploy App / docker (ubuntu-latest) (push) Has been cancelled

This commit is contained in:
Lee
2024-04-18 01:21:38 +01:00
parent f5203f9742
commit defdcccdb6
14 changed files with 143 additions and 9 deletions

View File

@ -13,6 +13,7 @@ import {
} from "mcutils-library";
import { Metadata } from "next";
import Image from "next/image";
import { ReactElement } from "react";
type Params = {
params: {
@ -30,7 +31,7 @@ type Params = {
*/
function getFavicon(
platform: ServerPlatform,
server: CachedJavaMinecraftServer | CachedBedrockMinecraftServer
server: CachedJavaMinecraftServer | CachedBedrockMinecraftServer,
): string | undefined {
if (platform === ServerPlatform.Bedrock) {
return undefined;
@ -88,14 +89,13 @@ export async function generateMetadata({ params: { platform, hostname } }: Param
}
}
export default async function Page({ params: { platform, hostname } }: Params): Promise<JSX.Element> {
export default async function Page({ params: { platform, hostname } }: Params): Promise<ReactElement> {
let error: string | undefined = undefined; // The error to display
let server: CachedJavaMinecraftServer | CachedBedrockMinecraftServer | undefined = undefined; // The server to display
let invalidPlatform = checkPlatform(platform) === false; // Whether the platform is invalid
let invalidPlatform = !checkPlatform(platform); // Whether the platform is invalid
// Try and get the player to display
try {
console.log(platform);
if (invalidPlatform) {
error = "Invalid platform"; // Set the error message
} else {