server json icon overlaps sometimes - removing for now
All checks were successful
Deploy App / docker (ubuntu-latest) (push) Successful in 1m3s

This commit is contained in:
Lee 2024-04-18 05:57:09 +01:00
parent ea98b2bd5a
commit 19e386b539
2 changed files with 7 additions and 18 deletions

@ -1,5 +1,6 @@
{
"siteName": "Minecraft Utilities",
"siteDescription": "Minecraft Utilities offers you many endpoints to get information about a minecraft server or a player.",
"siteUrl": "https://mcutils.xyz/"
"siteUrl": "https://mcutils.xyz/",
"apiUrl": "https://api.mcutils.xyz"
}

@ -1,5 +1,4 @@
import { Card } from "@/app/components/card";
import { CodeDialog } from "@/app/components/code-dialog";
import { CopyButton } from "@/app/components/copy-button";
import { ErrorCard } from "@/app/components/error-card";
import { LookupServer } from "@/app/components/server/lookup-server";
@ -17,6 +16,7 @@ import {
import { Metadata } from "next";
import Image from "next/image";
import { ReactElement } from "react";
import config from "../../../../../../config.json";
type Params = {
params: {
@ -34,10 +34,10 @@ type Params = {
*/
function getFavicon(
platform: ServerPlatform,
server: CachedJavaMinecraftServer | CachedBedrockMinecraftServer,
server: CachedJavaMinecraftServer | CachedBedrockMinecraftServer | undefined,
): string | undefined {
if (platform === ServerPlatform.Bedrock) {
return undefined;
return config.apiUrl + "/server/icon/fallback";
}
server = server as CachedJavaMinecraftServer;
return server.favicon && server.favicon.url;
@ -72,7 +72,7 @@ export async function generateMetadata({ params: { platform, hostname } }: Param
const server = await getServer(platform, hostname);
const { hostname: serverHostname, players } = server as CachedJavaMinecraftServer | CachedBedrockMinecraftServer;
const favicon = server ? getFavicon(platform, server) : undefined;
const favicon = getFavicon(platform, server);
let description = `Hostname: ${serverHostname}\n`;
description += `${players.online}/${players.max} players online\n\n`;
@ -108,7 +108,7 @@ export default async function Page({ params: { platform, hostname } }: Params):
error = (err as McUtilsAPIError).message; // Set the error message
}
const favicon = server ? getFavicon(platform, server) : undefined;
const favicon = getFavicon(platform, server);
return (
<div className="h-full flex flex-col items-center">
@ -124,18 +124,6 @@ export default async function Page({ params: { platform, hostname } }: Params):
<ContextMenu>
<ContextMenuTrigger>
<Card className="w-max xs:w-fit relative">
<div className="absolute top-0 right-0 p-2">
<CodeDialog
title="Server Data"
description="The server's data from the API"
code={JSON.stringify(server, undefined, 2)}
>
<button className="bg-background rounded-lg">
<p className="p-1">JSON</p>
</button>
</CodeDialog>
</div>
<div className="flex gap-2 flex-col">
<div className="flex gap-4 flex-col xs:flex-row">
{favicon && (