This commit is contained in:
parent
4505a61653
commit
269653ed55
@ -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} />}
|
||||
|
@ -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>
|
||||
|
Loading…
Reference in New Issue
Block a user