feat: disable continue button
This commit is contained in:
parent
de575a9215
commit
1c52097350
|
@ -8,13 +8,21 @@ import { RootState } from '../../redux/store'
|
||||||
type ContinueButton = {
|
type ContinueButton = {
|
||||||
continueHandler: () => void
|
continueHandler: () => void
|
||||||
activeStep: number
|
activeStep: number
|
||||||
|
isConfirmPhraseStage: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
const ContinueButton = ({ continueHandler, activeStep }: ContinueButton) => {
|
const ContinueButton = ({ continueHandler, activeStep, isConfirmPhraseStage }: ContinueButton) => {
|
||||||
const isCopyPastedPhrase = useSelector(
|
const { isCopyPastedPhrase, isRightPhrase } = useSelector(
|
||||||
(state: RootState) => state.keyGeneration.isCopyPastedPhrase,
|
(state: RootState) => state.keyGeneration,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const isDisabled = () => {
|
||||||
|
if (isConfirmPhraseStage && !isRightPhrase) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<XStack style={{ width: '100%', marginTop: '16px', zIndex: 999, alignItems: 'center' }}>
|
<XStack style={{ width: '100%', marginTop: '16px', zIndex: 999, alignItems: 'center' }}>
|
||||||
<Stack style={{ width: '100%' }}>
|
<Stack style={{ width: '100%' }}>
|
||||||
|
@ -35,7 +43,7 @@ const ContinueButton = ({ continueHandler, activeStep }: ContinueButton) => {
|
||||||
marginTop: isCopyPastedPhrase ? '0px' : '40px',
|
marginTop: isCopyPastedPhrase ? '0px' : '40px',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Button onPress={continueHandler} size={40}>
|
<Button onPress={continueHandler} size={40} disabled={isDisabled()}>
|
||||||
{activeStep < 5 ? 'Continue' : 'Continue to Dashboard'}
|
{activeStep < 5 ? 'Continue' : 'Continue to Dashboard'}
|
||||||
</Button>
|
</Button>
|
||||||
</Stack>
|
</Stack>
|
||||||
|
|
|
@ -87,7 +87,11 @@ const ValidatorOnboarding = () => {
|
||||||
{activeStep === 4 && <KeyGeneration isConfirmPhraseStage={isConfirmPhraseStage} />}
|
{activeStep === 4 && <KeyGeneration isConfirmPhraseStage={isConfirmPhraseStage} />}
|
||||||
{activeStep === 5 && <Activation />}
|
{activeStep === 5 && <Activation />}
|
||||||
</ValidatorBoxWrapper>
|
</ValidatorBoxWrapper>
|
||||||
<ContinueButton activeStep={activeStep} continueHandler={continueHandler} />
|
<ContinueButton
|
||||||
|
activeStep={activeStep}
|
||||||
|
continueHandler={continueHandler}
|
||||||
|
isConfirmPhraseStage={isConfirmPhraseStage}
|
||||||
|
/>
|
||||||
</YStack>
|
</YStack>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
|
|
|
@ -3,6 +3,7 @@ import { createSlice, PayloadAction } from '@reduxjs/toolkit'
|
||||||
type KeyGenerationState = {
|
type KeyGenerationState = {
|
||||||
words: string[]
|
words: string[]
|
||||||
isCopyPastedPhrase: boolean
|
isCopyPastedPhrase: boolean
|
||||||
|
isRightPhrase: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
type wordProps = {
|
type wordProps = {
|
||||||
|
@ -13,6 +14,7 @@ type wordProps = {
|
||||||
const initialState: KeyGenerationState = {
|
const initialState: KeyGenerationState = {
|
||||||
words: Array(24).fill(''),
|
words: Array(24).fill(''),
|
||||||
isCopyPastedPhrase: false,
|
isCopyPastedPhrase: false,
|
||||||
|
isRightPhrase: false,
|
||||||
}
|
}
|
||||||
|
|
||||||
const keyGenerationSlice = createSlice({
|
const keyGenerationSlice = createSlice({
|
||||||
|
@ -30,13 +32,13 @@ const keyGenerationSlice = createSlice({
|
||||||
setIsCopyPastedPhrase: (state, action: PayloadAction<boolean>) => {
|
setIsCopyPastedPhrase: (state, action: PayloadAction<boolean>) => {
|
||||||
state.isCopyPastedPhrase = action.payload
|
state.isCopyPastedPhrase = action.payload
|
||||||
},
|
},
|
||||||
|
setIsRightPhrase: (state, action: PayloadAction<boolean>) => {
|
||||||
|
state.isRightPhrase = action.payload
|
||||||
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
export const {
|
export const { setWord, setMnemonic, setIsCopyPastedPhrase, setIsRightPhrase } =
|
||||||
setWord,
|
keyGenerationSlice.actions
|
||||||
setMnemonic,
|
|
||||||
setIsCopyPastedPhrase,
|
|
||||||
} = keyGenerationSlice.actions
|
|
||||||
|
|
||||||
export default keyGenerationSlice.reducer
|
export default keyGenerationSlice.reducer
|
||||||
|
|
Loading…
Reference in New Issue