mirror of
https://github.com/status-im/nimbus-gui.git
synced 2025-02-09 10:03:36 +00:00
Disable continue if non validator is set
This commit is contained in:
parent
65c2c9c5ef
commit
6580b72348
@ -1,4 +1,4 @@
|
||||
import { useState } from 'react'
|
||||
import { useEffect, useState } from 'react'
|
||||
import { Separator, YStack } from 'tamagui'
|
||||
import { Text } from '@status-im/components'
|
||||
|
||||
@ -6,14 +6,20 @@ import WithdrawalAddress from './WithdrawalAddress'
|
||||
import LinkWithArrow from '../../../components/General/LinkWithArrow'
|
||||
import ValidatorsMenuWithPrice from '../../../components/General/ValidatorsMenuWithPrice'
|
||||
import { CLIENT_SETUP_SUBTITLE } from '../../../constants'
|
||||
|
||||
const ClientSetup = () => {
|
||||
type ClientSetupProps = {
|
||||
setIsValidatorSet: (value: boolean) => void
|
||||
}
|
||||
const ClientSetup = ({ setIsValidatorSet }: ClientSetupProps) => {
|
||||
const [validatorCount, setValidatorCount] = useState(0)
|
||||
useEffect(() => {
|
||||
setIsValidatorSet(validatorCount > 0)
|
||||
}, [validatorCount])
|
||||
|
||||
const changeValidatorCountHandler = (value: string) => {
|
||||
const numberValue = Number(value)
|
||||
if (!isNaN(numberValue)) {
|
||||
setValidatorCount(numberValue)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -11,6 +11,7 @@ type ContinueButton = {
|
||||
activeStep: number
|
||||
isConfirmPhraseStage: boolean
|
||||
subStepValidatorSetup: number
|
||||
isValidatorSet?: boolean
|
||||
}
|
||||
|
||||
const ContinueButton = ({
|
||||
@ -18,6 +19,7 @@ const ContinueButton = ({
|
||||
activeStep,
|
||||
isConfirmPhraseStage,
|
||||
subStepValidatorSetup,
|
||||
isValidatorSet
|
||||
}: ContinueButton) => {
|
||||
const { isCopyPastedPhrase, words, validWords } = useSelector(
|
||||
(state: RootState) => state.keyGeneration,
|
||||
@ -68,7 +70,7 @@ const ContinueButton = ({
|
||||
alignItems: 'end',
|
||||
}}
|
||||
>
|
||||
<Button onPress={continueHandler} size={40} disabled={isDisabled()}>
|
||||
<Button onPress={continueHandler} size={40} disabled={isDisabled() || (isValidatorSet === false && activeStep === 3)}>
|
||||
{activeStep < 6 ? 'Continue' : 'Continue to Dashboard'}
|
||||
</Button>
|
||||
</Stack>
|
||||
|
@ -33,6 +33,8 @@ const ValidatorOnboarding = () => {
|
||||
|
||||
const [subStepAdvisories, setSubStepAdvisories] = useState(0)
|
||||
|
||||
const [isValidatorSet, setIsValidatorSet] = useState(false)
|
||||
|
||||
const { isCopyPastedPhrase, words } = useSelector((state: RootState) => state.keyGeneration)
|
||||
const { isWalletConnected } = useSelector((state: RootState) => state.deposit)
|
||||
const navigate = useNavigate()
|
||||
@ -127,7 +129,7 @@ const ValidatorOnboarding = () => {
|
||||
{activeStep === 2 && subStepValidatorSetup === 1 && <ValidatorSetupInstall />}
|
||||
{activeStep === 2 && subStepValidatorSetup === 2 && <ConsensusSelection />}
|
||||
{activeStep === 2 && subStepValidatorSetup === 3 && <ActivationValidatorSetup />}
|
||||
{activeStep === 3 && <ClientSetup />}
|
||||
{activeStep === 3 && <ClientSetup setIsValidatorSet={setIsValidatorSet}/>}
|
||||
|
||||
{activeStep === 4 && <KeyGeneration isConfirmPhraseStage={isConfirmPhraseStage} />}
|
||||
{activeStep === 5 && <Deposit />}
|
||||
@ -159,6 +161,7 @@ const ValidatorOnboarding = () => {
|
||||
continueHandler={continueHandler}
|
||||
isConfirmPhraseStage={isConfirmPhraseStage}
|
||||
subStepValidatorSetup={subStepValidatorSetup}
|
||||
isValidatorSet={isValidatorSet}
|
||||
/>
|
||||
</YStack>
|
||||
</div>
|
||||
|
Loading…
x
Reference in New Issue
Block a user