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>
|
<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>
|
<p>You can enter a server hostname to get information about the server.</p>
|
||||||
|
|
||||||
<LookupServer currentPlatform={capitalizeFirstLetter(platform)} />
|
<LookupServer currentPlatform={platform.toLocaleLowerCase()} />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{error && <ErrorCard message={error} />}
|
{error && <ErrorCard message={error} />}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
|
import { capitalizeFirstLetter } from "@/common/string-utils";
|
||||||
import { useToast } from "@/common/use-toast";
|
import { useToast } from "@/common/use-toast";
|
||||||
import { ServerPlatform, getServer } from "mcutils-library";
|
import { ServerPlatform, getServer } from "mcutils-library";
|
||||||
import { useRouter } from "next/navigation";
|
import { useRouter } from "next/navigation";
|
||||||
@ -24,7 +25,7 @@ export function LookupServer({ currentPlatform }: LookupServerProps): ReactEleme
|
|||||||
* @param query the query to lookup
|
* @param query the query to lookup
|
||||||
*/
|
*/
|
||||||
const lookupServer = async (platform: ServerPlatform, query: string) => {
|
const lookupServer = async (platform: ServerPlatform, query: string) => {
|
||||||
if (!query || query.length === 0) {
|
if (query == null || query.length === 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -52,14 +53,19 @@ export function LookupServer({ currentPlatform }: LookupServerProps): ReactEleme
|
|||||||
>
|
>
|
||||||
<div className="flex gap-2 justify-center">
|
<div className="flex gap-2 justify-center">
|
||||||
<div className="flex flex-col gap-2 items-start">
|
<div className="flex flex-col gap-2 items-start">
|
||||||
<Label>Platform</Label>
|
<Label htmlFor="platform">Platform</Label>
|
||||||
<Select name="platform">
|
<Select name="platform" defaultValue={currentPlatform}>
|
||||||
<SelectTrigger className="w-[180px]">
|
<SelectTrigger className="w-[180px]">
|
||||||
<SelectValue placeholder={currentPlatform} />
|
<SelectValue />
|
||||||
</SelectTrigger>
|
</SelectTrigger>
|
||||||
<SelectContent>
|
<SelectContent>
|
||||||
<SelectItem value={ServerPlatform.Java}>Java</SelectItem>
|
{Object.entries(ServerPlatform).map(([_, platform], index) => {
|
||||||
<SelectItem value={ServerPlatform.Bedrock}>Bedrock</SelectItem>
|
return (
|
||||||
|
<SelectItem key={index} value={platform}>
|
||||||
|
{capitalizeFirstLetter(platform)}
|
||||||
|
</SelectItem>
|
||||||
|
);
|
||||||
|
})}
|
||||||
</SelectContent>
|
</SelectContent>
|
||||||
</Select>
|
</Select>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user