Next.js 16 + Tailwind v4 + shadcn v4 dashboard for managing a modded Forge 1.20.1 server. Includes server controls, player management, mod manager with Modrinth search and dependency resolution, world backups, snapshots, analytics, logs, and chat bridge. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
40 lines
1.1 KiB
TypeScript
40 lines
1.1 KiB
TypeScript
import { Badge } from "@/components/ui/badge";
|
|
|
|
type Status = "online" | "starting" | "offline";
|
|
|
|
const config = {
|
|
online: {
|
|
label: "Online",
|
|
className: "border-emerald-500/30 bg-emerald-500/10 text-emerald-300",
|
|
dot: "bg-emerald-400 shadow-[0_0_6px_var(--color-emerald-400)]",
|
|
pulse: false,
|
|
},
|
|
starting: {
|
|
label: "Starting",
|
|
className: "border-amber-500/30 bg-amber-500/10 text-amber-300",
|
|
dot: "bg-amber-400",
|
|
pulse: true,
|
|
},
|
|
offline: {
|
|
label: "Offline",
|
|
className: "border-red-500/30 bg-red-500/10 text-red-300",
|
|
dot: "bg-red-400",
|
|
pulse: false,
|
|
},
|
|
} as const;
|
|
|
|
export function StatusBadge({ status }: { status: Status }) {
|
|
const c = config[status];
|
|
return (
|
|
<Badge variant="outline" className={`gap-1.5 ${c.className}`}>
|
|
<span className={`h-1.5 w-1.5 rounded-full ${c.dot} ${c.pulse ? "animate-pulse" : ""}`} />
|
|
{c.label}
|
|
</Badge>
|
|
);
|
|
}
|
|
|
|
export function statusFromServer(s: { online: boolean; starting?: boolean }): Status {
|
|
if (s.online) return "online";
|
|
if (s.starting) return "starting";
|
|
return "offline";
|
|
}
|