Add developer API, Prometheus metrics, and community links
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
"use client";
|
||||
import { useI18n } from "@/components/I18nProvider";
|
||||
|
||||
import { useState } from "react";
|
||||
import { useRef, useState } from "react";
|
||||
import Link from "next/link";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { ArrowRight, Timer, ZoomIn, Users } from "lucide-react";
|
||||
@@ -22,7 +22,10 @@ export function StartGame({
|
||||
[loading, setLoading] = useState(false),
|
||||
[error, setError] = useState("");
|
||||
const router = useRouter();
|
||||
const starting = useRef(false);
|
||||
async function start() {
|
||||
if (starting.current) return;
|
||||
starting.current = true;
|
||||
setLoading(true);
|
||||
setError("");
|
||||
try {
|
||||
@@ -36,6 +39,7 @@ export function StartGame({
|
||||
);
|
||||
router.push((mode === "solo" ? "/play/" : "/multiplayer/") + session.id);
|
||||
} catch (e) {
|
||||
starting.current = false;
|
||||
setError((e as Error).message);
|
||||
setLoading(false);
|
||||
}
|
||||
@@ -68,6 +72,7 @@ export function StartGame({
|
||||
key={key}
|
||||
aria-pressed={difficulty === key}
|
||||
className={difficulty === key ? "selected" : ""}
|
||||
disabled={loading}
|
||||
onClick={() => setDifficulty(key as Difficulty)}
|
||||
>
|
||||
<strong>{t(value.label)}</strong>
|
||||
|
||||
Reference in New Issue
Block a user