#9: make the user-chosen path more clear to see.
Some checks reported errors
continuous-integration/drone/push Build encountered an error
continuous-integration/drone/pr Build encountered an error

This commit is contained in:
Manuel Friedli 2025-01-11 00:29:16 +01:00
parent 78b8772eff
commit 9efd718c9c
Signed by: manuel
GPG key ID: 41D08ABA75634DA1
5 changed files with 137 additions and 12 deletions

View file

@ -1,6 +1,12 @@
import {ActionDispatch, FormEvent, useState} from 'react';
import ValidatingInputNumberField, {ValidatorFunction} from "./validating-input-number-field.tsx";
import {Action, actionLoadedMaze, actionLoadingFailed, actionStartedLoading} from "./state/action.ts";
import {
Action,
actionLoadedMaze,
actionLoadingFailed,
actionStartedLoading,
actionToggledShowSolution
} from "./state/action.ts";
import styles from "./input-form.module.css";
import "./input-form.css";
import {State} from "@/app/state/state.ts";
@ -17,10 +23,10 @@ export default function InputForm({state, dispatch}: {
const handleSubmit = (e: FormEvent) => {
e.preventDefault();
dispatch(actionStartedLoading());
dispatch(actionToggledShowSolution(false));
const url = `https://manuel.friedli.info/labyrinth/create/json?w=${width}&h=${height}&id=${id || ''}&algorithm=${algorithm}`;
fetch(url)
.then(response => response.json())
// .then(result => new Promise(resolve => setTimeout(resolve, 600, result)))
.then(result => {
dispatch(actionLoadedMaze(result));
})