Add map-specific tournament creation link
Some checks failed
Deploy MineGeo to Dokploy / deploy (push) Failing after 3m31s
Some checks failed
Deploy MineGeo to Dokploy / deploy (push) Failing after 3m31s
This commit is contained in:
@@ -37,7 +37,13 @@ function time(value: string, zone: string) {
|
||||
timeZone: zone,
|
||||
}).format(new Date(value));
|
||||
}
|
||||
export function TournamentIndex({ signedIn }: { signedIn: boolean }) {
|
||||
export function TournamentIndex({
|
||||
signedIn,
|
||||
initialMapId = null,
|
||||
}: {
|
||||
signedIn: boolean;
|
||||
initialMapId?: string | null;
|
||||
}) {
|
||||
const { t } = useI18n();
|
||||
const router = useRouter();
|
||||
const [events, setEvents] = useState<Events | null>(null);
|
||||
@@ -45,7 +51,8 @@ export function TournamentIndex({ signedIn }: { signedIn: boolean }) {
|
||||
const [presets, setPresets] = useState<DifficultyPreset[]>([]);
|
||||
const [error, setError] = useState("");
|
||||
const [busy, setBusy] = useState(false);
|
||||
const [creating, setCreating] = useState(false);
|
||||
const [creating, setCreating] = useState(!!(signedIn && initialMapId));
|
||||
const [selectedMap, setSelectedMap] = useState(initialMapId ?? "");
|
||||
const [clock, setClock] = useState(0);
|
||||
const [timerMode, setTimerMode] = useState<"shared" | "perMini">("shared");
|
||||
const [roundSeconds, setRoundSeconds] = useState(450);
|
||||
@@ -83,6 +90,9 @@ export function TournamentIndex({ signedIn }: { signedIn: boolean }) {
|
||||
if (active) {
|
||||
setMaps(catalog.maps);
|
||||
setPresets(difficulties.presets);
|
||||
setSelectedMap((current) =>
|
||||
catalog.maps.some((map) => map.id === current) ? current : "",
|
||||
);
|
||||
}
|
||||
})
|
||||
.catch((e) => {
|
||||
@@ -183,7 +193,12 @@ export function TournamentIndex({ signedIn }: { signedIn: boolean }) {
|
||||
</label>
|
||||
<label>
|
||||
{t("Map")}
|
||||
<select name="dataset" required defaultValue="">
|
||||
<select
|
||||
name="dataset"
|
||||
required
|
||||
value={selectedMap}
|
||||
onChange={(event) => setSelectedMap(event.target.value)}
|
||||
>
|
||||
<option value="" disabled>
|
||||
{t("Choose a map")}
|
||||
</option>
|
||||
|
||||
Reference in New Issue
Block a user