mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
fba17d77de
* Refactor and fix styling for first time flow. Remove seed phrase from persisted metamask state * Fix linting and tests * Fix translations, initialization notice routing * Fix drizzle tests * Fix e2e tests * Fix integration tests * Fix styling * Fix migration naming from 030 to 031 * Open extension in browser when user has not completed onboarding
58 lines
1.4 KiB
JavaScript
58 lines
1.4 KiB
JavaScript
import React, { PureComponent } from 'react'
|
|
import PropTypes from 'prop-types'
|
|
import { Redirect } from 'react-router-dom'
|
|
import {
|
|
DEFAULT_ROUTE,
|
|
LOCK_ROUTE,
|
|
INITIALIZE_WELCOME_ROUTE,
|
|
INITIALIZE_NOTICE_ROUTE,
|
|
INITIALIZE_UNLOCK_ROUTE,
|
|
INITIALIZE_SEED_PHRASE_ROUTE,
|
|
} from '../../../../routes'
|
|
|
|
export default class FirstTimeFlowSwitch extends PureComponent {
|
|
static propTypes = {
|
|
completedOnboarding: PropTypes.bool,
|
|
isInitialized: PropTypes.bool,
|
|
isUnlocked: PropTypes.bool,
|
|
noActiveNotices: PropTypes.bool,
|
|
seedPhrase: PropTypes.string,
|
|
}
|
|
|
|
render () {
|
|
const {
|
|
completedOnboarding,
|
|
isInitialized,
|
|
isUnlocked,
|
|
noActiveNotices,
|
|
seedPhrase,
|
|
} = this.props
|
|
|
|
if (completedOnboarding) {
|
|
return <Redirect to={{ pathname: DEFAULT_ROUTE }} />
|
|
}
|
|
|
|
if (isUnlocked && !seedPhrase) {
|
|
return <Redirect to={{ pathname: LOCK_ROUTE }} />
|
|
}
|
|
|
|
if (!isInitialized) {
|
|
return <Redirect to={{ pathname: INITIALIZE_WELCOME_ROUTE }} />
|
|
}
|
|
|
|
if (!isUnlocked) {
|
|
return <Redirect to={{ pathname: INITIALIZE_UNLOCK_ROUTE }} />
|
|
}
|
|
|
|
if (!noActiveNotices) {
|
|
return <Redirect to={{ pathname: INITIALIZE_NOTICE_ROUTE }} />
|
|
}
|
|
|
|
if (seedPhrase) {
|
|
return <Redirect to={{ pathname: INITIALIZE_SEED_PHRASE_ROUTE }} />
|
|
}
|
|
|
|
return <Redirect to={{ pathname: INITIALIZE_WELCOME_ROUTE }} />
|
|
}
|
|
}
|