cleanup
All checks were successful
Deploy App / docker (ubuntu-latest) (push) Successful in 1m5s

This commit is contained in:
Lee 2024-04-18 05:37:48 +01:00
parent 4505a61653
commit 269653ed55
2 changed files with 13 additions and 7 deletions

View File

@ -116,7 +116,7 @@ export default async function Page({ params: { platform, hostname } }: Params):
<h1 className="text-xl">Lookup a {invalidPlatform ? "" : capitalizeFirstLetter(platform)} Server</h1>
<p>You can enter a server hostname to get information about the server.</p>
<LookupServer currentPlatform={capitalizeFirstLetter(platform)} />
<LookupServer currentPlatform={platform.toLocaleLowerCase()} />
</div>
{error && <ErrorCard message={error} />}

View File

@ -1,5 +1,6 @@
"use client";
import { capitalizeFirstLetter } from "@/common/string-utils";
import { useToast } from "@/common/use-toast";
import { ServerPlatform, getServer } from "mcutils-library";
import { useRouter } from "next/navigation";
@ -24,7 +25,7 @@ export function LookupServer({ currentPlatform }: LookupServerProps): ReactEleme
* @param query the query to lookup
*/
const lookupServer = async (platform: ServerPlatform, query: string) => {
if (!query || query.length === 0) {
if (query == null || query.length === 0) {
return;
}
@ -52,14 +53,19 @@ export function LookupServer({ currentPlatform }: LookupServerProps): ReactEleme
>
<div className="flex gap-2 justify-center">
<div className="flex flex-col gap-2 items-start">
<Label>Platform</Label>
<Select name="platform">
<Label htmlFor="platform">Platform</Label>
<Select name="platform" defaultValue={currentPlatform}>
<SelectTrigger className="w-[180px]">
<SelectValue placeholder={currentPlatform} />
<SelectValue />
</SelectTrigger>
<SelectContent>
<SelectItem value={ServerPlatform.Java}>Java</SelectItem>
<SelectItem value={ServerPlatform.Bedrock}>Bedrock</SelectItem>
{Object.entries(ServerPlatform).map(([_, platform], index) => {
return (
<SelectItem key={index} value={platform}>
{capitalizeFirstLetter(platform)}
</SelectItem>
);
})}
</SelectContent>
</Select>
</div>