From 8ead128259343192572a12050d96d46fc9291aed Mon Sep 17 00:00:00 2001 From: goosewobbler Date: Fri, 24 Mar 2023 12:22:08 +0000 Subject: [PATCH] add processing step --- app/dash/Accounts/Add/Components/index.js | 8 ++++++- app/dash/Accounts/Add/style/index.styl | 8 ++++++- resources/Components/Password/index.js | 28 +++++++++++++++++++---- 3 files changed, 38 insertions(+), 6 deletions(-) diff --git a/app/dash/Accounts/Add/Components/index.js b/app/dash/Accounts/Add/Components/index.js index 61d82c0e3..8270e64b3 100644 --- a/app/dash/Accounts/Add/Components/index.js +++ b/app/dash/Accounts/Add/Components/index.js @@ -165,7 +165,13 @@ export function AddHotAccount({ const steps = [ firstFlowStep, , - , + , ] diff --git a/app/dash/Accounts/Add/style/index.styl b/app/dash/Accounts/Add/style/index.styl index 15d08f526..4b16c195a 100644 --- a/app/dash/Accounts/Add/style/index.styl +++ b/app/dash/Accounts/Add/style/index.styl @@ -277,9 +277,15 @@ font-size 12px color var(--moon) text-align center + + .addAccountItemOptionProcessing + height 34px + padding 0px 20px + margin-top 12px + font-size 12px + text-align center .addAccountItemOptionSubmit - background var(--ghostB) height 32px border-radius 16px padding 0px 40px diff --git a/resources/Components/Password/index.js b/resources/Components/Password/index.js index 138889100..7d0f39f55 100644 --- a/resources/Components/Password/index.js +++ b/resources/Components/Password/index.js @@ -6,21 +6,36 @@ import { debounce } from '../../utils' const NO_PASSWORD_ENTERED = 'Enter password' -export const PasswordInput = ({ getError: getInputError, next, title, buttonText, autofocus }) => { +export const PasswordInput = ({ + getError: getInputError, + next, + title, + buttonText, + autofocus, + lastStep = false +}) => { const [error, setError] = useState(NO_PASSWORD_ENTERED) const inputRef = useFocusableRef(autofocus) const [disabled, setDisabled] = useState(false) + const [processing, setProcessing] = useState(false) const resetError = () => setError(NO_PASSWORD_ENTERED) const clear = () => { - resetError() inputRef.current && (inputRef.current.value = '') } const handleSubmit = () => { next(inputRef.current.value) - setTimeout(clear, 1_000) + if (lastStep) { + setProcessing(true) + clear() + } else { + setTimeout(() => { + resetError() + clear() + }, 1_000) + } } const getError = () => @@ -60,6 +75,10 @@ export const PasswordInput = ({ getError: getInputError, next, title, buttonText
{error}
+ ) : processing ? ( +
+ Processing... +
) : (
!disabled && handleSubmit()}> {buttonText} @@ -92,7 +111,7 @@ export const CreatePassword = ({ onCreate, autofocus }) => { ) } -export const ConfirmPassword = ({ password, onConfirm, autofocus }) => { +export const ConfirmPassword = ({ password, onConfirm, autofocus, lastStep }) => { const getError = (confirmedPassword) => { if (password !== confirmedPassword) return 'PASSWORDS DO NOT MATCH' } @@ -104,6 +123,7 @@ export const ConfirmPassword = ({ password, onConfirm, autofocus }) => { title='Confirm Password' buttonText='Create' autofocus={autofocus} + lastStep={lastStep} /> ) }