diff options
Diffstat (limited to 'mascara/src/app/first-time/index.js')
-rw-r--r-- | mascara/src/app/first-time/index.js | 43 |
1 files changed, 37 insertions, 6 deletions
diff --git a/mascara/src/app/first-time/index.js b/mascara/src/app/first-time/index.js index 66b591bd8..da2f6bab9 100644 --- a/mascara/src/app/first-time/index.js +++ b/mascara/src/app/first-time/index.js @@ -1,4 +1,5 @@ -import React, {Component, PropTypes} from 'react' +import React, { Component } from 'react' +import PropTypes from 'prop-types' import {connect} from 'react-redux' import CreatePasswordScreen from './create-password-screen' import UniqueImageScreen from './unique-image-screen' @@ -6,7 +7,10 @@ import NoticeScreen from './notice-screen' import BackupPhraseScreen from './backup-phrase-screen' import ImportAccountScreen from './import-account-screen' import ImportSeedPhraseScreen from './import-seed-phrase-screen' -import {onboardingBuyEthView} from '../../../../ui/app/actions' +import { + onboardingBuyEthView, + unMarkPasswordForgotten, +} from '../../../../ui/app/actions' class FirstTimeFlow extends Component { @@ -32,6 +36,7 @@ class FirstTimeFlow extends Component { NOTICE: 'notice', BACK_UP_PHRASE: 'back_up_phrase', CONFIRM_BACK_UP_PHRASE: 'confirm_back_up_phrase', + LOADING: 'loading', }; constructor (props) { @@ -50,11 +55,15 @@ class FirstTimeFlow extends Component { isInitialized, seedWords, noActiveNotices, + forgottenPassword, } = this.props const {SCREEN_TYPE} = FirstTimeFlow // return SCREEN_TYPE.NOTICE + if (forgottenPassword) { + return SCREEN_TYPE.IMPORT_SEED_PHRASE + } if (!isInitialized) { return SCREEN_TYPE.CREATE_PASSWORD } @@ -70,7 +79,13 @@ class FirstTimeFlow extends Component { renderScreen () { const {SCREEN_TYPE} = FirstTimeFlow - const {goToBuyEtherView, address} = this.props + const { + goToBuyEtherView, + address, + restoreCreatePasswordScreen, + forgottenPassword, + leaveImportSeedScreenState, + } = this.props switch (this.state.screenType) { case SCREEN_TYPE.CREATE_PASSWORD: @@ -91,8 +106,14 @@ class FirstTimeFlow extends Component { case SCREEN_TYPE.IMPORT_SEED_PHRASE: return ( <ImportSeedPhraseScreen - back={() => this.setScreenType(SCREEN_TYPE.CREATE_PASSWORD)} - next={() => this.setScreenType(SCREEN_TYPE.NOTICE)} + back={() => { + leaveImportSeedScreenState() + this.setScreenType(SCREEN_TYPE.CREATE_PASSWORD) + }} + next={() => { + const newScreenType = forgottenPassword ? null : SCREEN_TYPE.NOTICE + this.setScreenType(newScreenType) + }} /> ) case SCREEN_TYPE.UNIQUE_IMAGE: @@ -129,13 +150,23 @@ class FirstTimeFlow extends Component { } export default connect( - ({ metamask: { isInitialized, seedWords, noActiveNotices, selectedAddress } }) => ({ + ({ + metamask: { + isInitialized, + seedWords, + noActiveNotices, + selectedAddress, + forgottenPassword, + } + }) => ({ isInitialized, seedWords, noActiveNotices, address: selectedAddress, + forgottenPassword, }), dispatch => ({ + leaveImportSeedScreenState: () => dispatch(unMarkPasswordForgotten()), goToBuyEtherView: address => dispatch(onboardingBuyEthView(address)), }) )(FirstTimeFlow) |