"use client"; import { useI18n } from "@/components/I18nProvider"; import { useEffect, useState } from "react"; import { api } from "./StartGame"; export function MapRefresh({ id, disabled, onQueued, }: { id: string; disabled: boolean; onQueued: () => void; }) { const { t, formatDate } = useI18n(); const [sources, setSources] = useState< { id: string; name: string; created_at: string }[] >([]); const [source, setSource] = useState(id); const [busy, setBusy] = useState(false); const [error, setError] = useState(""); useEffect(() => { let active = true; api<{ sources: typeof sources }>(`datasets/${id}/refresh-map`) .then((r) => { if (active) setSources(r.sources); }) .catch((e) => { if (active) setError(e.message); }); return () => { active = false; }; }, [id]); async function refresh() { setBusy(true); setError(""); try { await api(`datasets/${id}/refresh-map`, { sourceId: source }); onQueued(); } catch (e) { setError((e as Error).message); } finally { setBusy(false); } } return (
{t("THE MAP PLAYERS GUESS ON")}

{t("Refresh guessing map")}

{t( "Rebuild the overhead map from a processed capture. To show new buildings, export the same area again and upload it first. Select that capture here; its boundaries must match this map exactly.", )}

{t( "Panoramas stay unchanged. Refreshing uses no panorama slots, even at 24/24. Submit the finished map update for review to make it playable.", )}

{error && (

{t(error)}

)}
); }