"use client"; import { useI18n } from "@/components/I18nProvider"; import { useState } from "react"; import { useRouter } from "next/navigation"; import { ArrowRight, Timer, ZoomIn } from "lucide-react"; import { difficulties, type Difficulty } from "@/shared/protocol"; import { api } from "@/lib/client-api"; export { api } from "@/lib/client-api"; export function StartGame({ datasetId }: { datasetId: string }) { const { t } = useI18n(); const [difficulty, setDifficulty] = useState("normal"), [loading, setLoading] = useState(false), [error, setError] = useState(""); const router = useRouter(); async function start() { setLoading(true); setError(""); try { const session = await api<{ id: string }>("sessions", { datasetId, difficulty, }); router.push("/play/" + session.id); } catch (e) { setError((e as Error).message); setLoading(false); } } return (
{t("YOUR EXPEDITION")}

{t("Choose your challenge.")}

{Object.entries(difficulties).map(([key, value]) => ( ))}

{t("5 rounds · 25,000 possible points · No movement")}

{error && (

{t(error)}

)}
); }