mirror of
https://github.com/status-im/nimbus-gui.git
synced 2025-02-03 07:03:30 +00:00
fix: disabled continue button
This commit is contained in:
parent
9b58e13bac
commit
a53fabc7c8
@ -5,6 +5,7 @@ import { useSelector } from 'react-redux'
|
|||||||
|
|
||||||
import { RootState } from '../../redux/store'
|
import { RootState } from '../../redux/store'
|
||||||
import LinkWithArrow from '../../components/General/LinkWithArrow'
|
import LinkWithArrow from '../../components/General/LinkWithArrow'
|
||||||
|
import { useEffect, useState } from 'react'
|
||||||
|
|
||||||
type ContinueButton = {
|
type ContinueButton = {
|
||||||
continueHandler: () => void
|
continueHandler: () => void
|
||||||
@ -13,20 +14,25 @@ type ContinueButton = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const ContinueButton = ({ continueHandler, activeStep, subStepValidatorSetup }: ContinueButton) => {
|
const ContinueButton = ({ continueHandler, activeStep, subStepValidatorSetup }: ContinueButton) => {
|
||||||
|
const [isDisabled, setIsDisabled] = useState(false)
|
||||||
const { isCopyPastedPhrase, mnemonic, validWords, isConfirmPhraseStage } = useSelector(
|
const { isCopyPastedPhrase, mnemonic, validWords, isConfirmPhraseStage } = useSelector(
|
||||||
(state: RootState) => state.keyGeneration,
|
(state: RootState) => state.keyGeneration,
|
||||||
)
|
)
|
||||||
const isActivationValScreen = activeStep === 3 && subStepValidatorSetup === 3
|
const isActivationValScreen = activeStep === 3 && subStepValidatorSetup === 3
|
||||||
|
|
||||||
const isDisabled = () => {
|
useEffect(() => {
|
||||||
if (
|
const getDisabledButton = () => {
|
||||||
(isConfirmPhraseStage && mnemonic.some(word => word === '')) ||
|
if (activeStep === 4 && isConfirmPhraseStage) {
|
||||||
(isConfirmPhraseStage && validWords.some(w => w === false))
|
if (mnemonic.some(word => word === '') || validWords.some(w => w === false)) {
|
||||||
) {
|
return false
|
||||||
return true
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false
|
||||||
}
|
}
|
||||||
return false
|
|
||||||
}
|
setIsDisabled(getDisabledButton())
|
||||||
|
}, [activeStep, subStepValidatorSetup, isConfirmPhraseStage, mnemonic, validWords])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<XStack
|
<XStack
|
||||||
@ -55,7 +61,7 @@ const ContinueButton = ({ continueHandler, activeStep, subStepValidatorSetup }:
|
|||||||
style={{ fontWeight: 'bold', zIndex: 999 }}
|
style={{ fontWeight: 'bold', zIndex: 999 }}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
<Button onPress={continueHandler} size={40} disabled={isDisabled()}>
|
<Button onPress={continueHandler} size={40} disabled={isDisabled}>
|
||||||
{activeStep < 5 ? 'Continue' : 'Continue to Dashboard'}
|
{activeStep < 5 ? 'Continue' : 'Continue to Dashboard'}
|
||||||
</Button>
|
</Button>
|
||||||
</XStack>
|
</XStack>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user