|
|
|
@ -8,7 +8,6 @@ import Identicon from '../../../../ui/app/components/identicon' |
|
|
|
|
import Breadcrumbs from './breadcrumbs' |
|
|
|
|
import LoadingScreen from './loading-screen' |
|
|
|
|
import { DEFAULT_ROUTE, INITIALIZE_CONFIRM_SEED_ROUTE } from '../../../../ui/app/routes' |
|
|
|
|
import { confirmSeedWords } from '../../../../ui/app/actions' |
|
|
|
|
|
|
|
|
|
const LockIcon = props => ( |
|
|
|
|
<svg |
|
|
|
@ -45,8 +44,6 @@ class BackupPhraseScreen extends Component { |
|
|
|
|
address: PropTypes.string.isRequired, |
|
|
|
|
seedWords: PropTypes.string, |
|
|
|
|
history: PropTypes.object, |
|
|
|
|
isRevealingSeedWords: PropTypes.bool, |
|
|
|
|
clearSeedWords: PropTypes.func, |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
static defaultProps = { |
|
|
|
@ -61,14 +58,6 @@ class BackupPhraseScreen extends Component { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
componentWillMount () { |
|
|
|
|
this.checkSeedWords() |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
componentDidUpdate () { |
|
|
|
|
this.checkSeedWords() |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
checkSeedWords () { |
|
|
|
|
const { seedWords, history } = this.props |
|
|
|
|
|
|
|
|
|
if (!seedWords) { |
|
|
|
@ -103,29 +92,9 @@ class BackupPhraseScreen extends Component { |
|
|
|
|
) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
renderSubmitButton () { |
|
|
|
|
const { isRevealingSeedWords, clearSeedWords, history } = this.props |
|
|
|
|
const { isShowingSecret } = this.state |
|
|
|
|
|
|
|
|
|
return isRevealingSeedWords |
|
|
|
|
? <button |
|
|
|
|
className="first-time-flow__button" |
|
|
|
|
onClick={() => clearSeedWords().then(() => history.push(DEFAULT_ROUTE))} |
|
|
|
|
disabled={!isShowingSecret} |
|
|
|
|
> |
|
|
|
|
Done |
|
|
|
|
</button> |
|
|
|
|
: <button |
|
|
|
|
className="first-time-flow__button" |
|
|
|
|
onClick={() => isShowingSecret && history.push(INITIALIZE_CONFIRM_SEED_ROUTE)} |
|
|
|
|
disabled={!isShowingSecret} |
|
|
|
|
> |
|
|
|
|
Next |
|
|
|
|
</button> |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
renderSecretScreen () { |
|
|
|
|
const { isRevealingSeedWords } = this.props |
|
|
|
|
const { isShowingSecret } = this.state |
|
|
|
|
const { history } = this.props |
|
|
|
|
|
|
|
|
|
return ( |
|
|
|
|
<div className="backup-phrase__content-wrapper"> |
|
|
|
@ -152,8 +121,14 @@ class BackupPhraseScreen extends Component { |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
<div className="backup-phrase__next-button"> |
|
|
|
|
{ this.renderSubmitButton() } |
|
|
|
|
{ !isRevealingSeedWords && <Breadcrumbs total={3} currentIndex={1} />} |
|
|
|
|
<button |
|
|
|
|
className="first-time-flow__button" |
|
|
|
|
onClick={() => isShowingSecret && history.push(INITIALIZE_CONFIRM_SEED_ROUTE)} |
|
|
|
|
disabled={!isShowingSecret} |
|
|
|
|
> |
|
|
|
|
Next |
|
|
|
|
</button> |
|
|
|
|
<Breadcrumbs total={3} currentIndex={1} /> |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
) |
|
|
|
@ -175,25 +150,13 @@ class BackupPhraseScreen extends Component { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const mapStateToProps = ({ metamask, appState }) => { |
|
|
|
|
const { selectedAddress, seedWords, isRevealingSeedWords } = metamask |
|
|
|
|
const { isLoading } = appState |
|
|
|
|
|
|
|
|
|
return { |
|
|
|
|
export default compose( |
|
|
|
|
withRouter, |
|
|
|
|
connect( |
|
|
|
|
({ metamask: { selectedAddress, seedWords }, appState: { isLoading } }) => ({ |
|
|
|
|
seedWords, |
|
|
|
|
isRevealingSeedWords, |
|
|
|
|
isLoading, |
|
|
|
|
address: selectedAddress, |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const mapDispatchToProps = dispatch => { |
|
|
|
|
return { |
|
|
|
|
clearSeedWords: () => dispatch(confirmSeedWords()), |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
export default compose( |
|
|
|
|
withRouter, |
|
|
|
|
connect(mapStateToProps, mapDispatchToProps), |
|
|
|
|
}) |
|
|
|
|
) |
|
|
|
|
)(BackupPhraseScreen) |
|
|
|
|