2025-02-15 17:18:58 -06:00
|
|
|
"use client";
|
2025-02-15 20:06:35 -06:00
|
|
|
import { Spinner } from "@/components/ui/spinner";
|
|
|
|
|
import { useServers } from "@/lib/hooks/use-servers";
|
|
|
|
|
import ServerCard from "./server-card";
|
|
|
|
|
import { Separator } from "@/components/ui/separator";
|
|
|
|
|
import { Statistics } from "./statistics";
|
|
|
|
|
|
2025-02-15 17:18:58 -06:00
|
|
|
export function ServerList() {
|
2025-02-15 20:06:35 -06:00
|
|
|
const { servers, loading, serverCount, playerCount } = useServers();
|
|
|
|
|
|
|
|
|
|
if (loading)
|
|
|
|
|
return (
|
|
|
|
|
<div className="absolute top-[50%] left-[50%]">
|
|
|
|
|
<Spinner />
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<main className="px-3 lg:px-16">
|
|
|
|
|
<h1 className="scroll-m-20 text-2xl font-extrabold tracking-tight lg:text-4xl mb-3">
|
|
|
|
|
Statistics
|
|
|
|
|
</h1>
|
|
|
|
|
<Statistics
|
|
|
|
|
totalServers={serverCount}
|
|
|
|
|
totalPlayers={playerCount}
|
|
|
|
|
topServer={servers[0]}
|
|
|
|
|
/>
|
|
|
|
|
<Separator className="my-3" />
|
|
|
|
|
<h1 className="scroll-m-20 text-2xl font-extrabold tracking-tight lg:text-4xl">
|
|
|
|
|
Servers
|
|
|
|
|
</h1>
|
|
|
|
|
<div className="grid grid-cols-4 gap-2 mt-3">
|
|
|
|
|
{servers.map((c) => (
|
|
|
|
|
<ServerCard server={c} key={c.name} />
|
|
|
|
|
))}
|
|
|
|
|
</div>
|
|
|
|
|
</main>
|
|
|
|
|
);
|
2025-02-15 17:18:58 -06:00
|
|
|
}
|