#9: make the user-chosen path more clear to see.
This commit is contained in:
parent
78b8772eff
commit
9efd718c9c
5 changed files with 137 additions and 12 deletions
|
|
@ -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));
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue