feat: remove is right phrase state and reducer
This commit is contained in:
parent
ed254afdbf
commit
522717cb1c
|
@ -1,11 +1,9 @@
|
|||
import { Stack, YStack } from 'tamagui'
|
||||
import { Button, InformationBox } from '@status-im/components'
|
||||
import { CloseCircleIcon } from '@status-im/icons'
|
||||
import { useDispatch, useSelector } from 'react-redux'
|
||||
import { useEffect } from 'react'
|
||||
import { useSelector } from 'react-redux'
|
||||
|
||||
import { RootState } from '../../redux/store'
|
||||
import { setIsRightPhrase } from '../../redux/ValidatorOnboarding/KeyGeneration/slice'
|
||||
import LinkWithArrow from '../../components/General/LinkWithArrow'
|
||||
|
||||
type ContinueButton = {
|
||||
|
@ -15,17 +13,13 @@ type ContinueButton = {
|
|||
}
|
||||
|
||||
const ContinueButton = ({ continueHandler, activeStep, subStepValidatorSetup }: ContinueButton) => {
|
||||
const { isCopyPastedPhrase, isRightPhrase, mnemonic, validWords, isConfirmPhraseStage } =
|
||||
useSelector((state: RootState) => state.keyGeneration)
|
||||
const dispatch = useDispatch()
|
||||
|
||||
useEffect(() => {
|
||||
dispatch(setIsRightPhrase(mnemonic.every(word => word !== '')))
|
||||
}, [mnemonic])
|
||||
const { isCopyPastedPhrase, mnemonic, validWords, isConfirmPhraseStage } = useSelector(
|
||||
(state: RootState) => state.keyGeneration,
|
||||
)
|
||||
|
||||
const isDisabled = () => {
|
||||
if (
|
||||
(isConfirmPhraseStage && !isRightPhrase) ||
|
||||
(isConfirmPhraseStage && mnemonic.some(word => word === '')) ||
|
||||
(isConfirmPhraseStage && validWords.some(w => w === false))
|
||||
) {
|
||||
return true
|
||||
|
|
|
@ -3,7 +3,6 @@ import { createSlice, PayloadAction } from '@reduxjs/toolkit'
|
|||
type KeyGenerationState = {
|
||||
mnemonic: string[]
|
||||
isCopyPastedPhrase: boolean
|
||||
isRightPhrase: boolean
|
||||
validWords: boolean[]
|
||||
generatedMnemonic: string[]
|
||||
isConfirmPhraseStage: boolean
|
||||
|
@ -17,7 +16,6 @@ type wordProps = {
|
|||
const initialState: KeyGenerationState = {
|
||||
mnemonic: Array(24).fill(''),
|
||||
isCopyPastedPhrase: false,
|
||||
isRightPhrase: false,
|
||||
validWords: Array(24).fill(true),
|
||||
generatedMnemonic: Array(24).fill(''),
|
||||
isConfirmPhraseStage: false,
|
||||
|
@ -38,9 +36,6 @@ const keyGenerationSlice = createSlice({
|
|||
setIsCopyPastedPhrase: (state, action: PayloadAction<boolean>) => {
|
||||
state.isCopyPastedPhrase = action.payload
|
||||
},
|
||||
setIsRightPhrase: (state, action: PayloadAction<boolean>) => {
|
||||
state.isRightPhrase = action.payload
|
||||
},
|
||||
setValidWords: (state, action: PayloadAction<boolean[]>) => {
|
||||
state.validWords = action.payload
|
||||
},
|
||||
|
@ -57,7 +52,6 @@ export const {
|
|||
setWord,
|
||||
setMnemonic,
|
||||
setIsCopyPastedPhrase,
|
||||
setIsRightPhrase,
|
||||
setValidWords,
|
||||
setGeneratedMnemonic,
|
||||
setIsConfirmPhraseStage,
|
||||
|
|
Loading…
Reference in New Issue