diff --git a/src/components/MultiStepForm.tsx b/src/components/MultiStepForm.tsx index bf7f49d..ffcd3ca 100644 --- a/src/components/MultiStepForm.tsx +++ b/src/components/MultiStepForm.tsx @@ -26,15 +26,20 @@ function MultiStepForm({ const [currentSize, setCurrentSize] = useState(null) const [nextSize, setNextSize] = useState(null) - const isTransitioning = currentIndex !== index + const isTransitioning = currentIndex < index useEffect(() => { - if (index !== currentIndex) { + if (index > currentIndex) { $timeout.current = setTimeout(() => { setCurrentSize(null) setNextSize(null) setCurrentIndex(index) }, duration) + } else if (index < currentIndex) { + // "Going-back" animation is not supported + setCurrentIndex(index) + setCurrentSize(null) + setNextSize(null) } return $timeout.current?.cancel! diff --git a/src/components/OpenMailButton.tsx b/src/components/OpenMailButton.tsx index 41b24e2..6d37bf2 100644 --- a/src/components/OpenMailButton.tsx +++ b/src/components/OpenMailButton.tsx @@ -19,7 +19,7 @@ export default function OpenMailButton({ return ( + + + + ) } diff --git a/src/routes/SignupRoute.tsx b/src/routes/SignupRoute.tsx index 17ef45a..102f64c 100644 --- a/src/routes/SignupRoute.tsx +++ b/src/routes/SignupRoute.tsx @@ -3,7 +3,7 @@ import {useLocalStorage} from "react-use" import {useLoaderData} from "react-router-dom" import {MultiStepForm} from "~/components" -import {ServerSettings} from "~/types" +import {ServerSettings} from "~/server-types" import EmailForm from "~/route-widgets/root/EmailForm" import YouGotMail from "~/route-widgets/root/YouGotMail" @@ -24,7 +24,11 @@ export default function SignupRoute(): ReactElement { onSignUp={setEmail} key="email" />, - , + setEmail("")} + email={email || ""} + key="you_got_mail" + />, ]} index={index} /> diff --git a/src/routes/VerifyEmailRoute.tsx b/src/routes/VerifyEmailRoute.tsx index 093e6ad..05323b5 100644 --- a/src/routes/VerifyEmailRoute.tsx +++ b/src/routes/VerifyEmailRoute.tsx @@ -6,7 +6,7 @@ import React, {ReactElement} from "react" import {Grid, Paper, Typography, useTheme} from "@mui/material" -import {ServerSettings} from "~/types" +import {ServerSettings} from "~/server-types" import {validateEmail} from "~/apis" const emailSchema = yup.string().email() diff --git a/src/utils/handle-errors.ts b/src/utils/handle-errors.ts deleted file mode 100644 index bd730d8..0000000 --- a/src/utils/handle-errors.ts +++ /dev/null @@ -1,17 +0,0 @@ -import {FormikHelpers} from "formik" -import parseFastAPIError from "./parse-fastapi-error" -import {AxiosError} from "axios" - -export default function handleErrors( - values: T, - setErrors: FormikHelpers["setErrors"], -) { - return async (callback: (values: T) => Promise) => { - try { - const result = await callback(values) - return result - } catch (error) { - setErrors(parseFastAPIError(error as AxiosError)) - } - } -} diff --git a/src/utils/index.ts b/src/utils/index.ts index 53da680..9bbea87 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -1,9 +1,7 @@ export * from "./app-url-links" export {default as APP_LINK_MAP} from "./app-url-links" export * from "./encrypt-string" -export { default as encryptString } from "./encrypt-string" -export * from "./handle-errors" -export {default as handleErrors} from "./handle-errors" +export {default as encryptString} from "./encrypt-string" export * from "./parse-fastapi-error" export {default as parseFastapiError} from "./parse-fastapi-error" export * from "./when-element-has-bounds"