1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-20 08:23:21 +01:00
metamask-extension/ui/app/pages/first-time-flow/first-time-flow-switch/first-time-flow-switch.component.js
Mark Stacey a578c725c8
Remove unused seedPhrase prop (#6913)
The `seedPhrase` prop has not been passed into the
`first-time-flow-switch` component since #5994.
2019-07-25 10:59:40 -03:00

51 lines
1.2 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_UNLOCK_ROUTE,
INITIALIZE_METAMETRICS_OPT_IN_ROUTE,
} from '../../../helpers/constants/routes'
export default class FirstTimeFlowSwitch extends PureComponent {
static propTypes = {
completedOnboarding: PropTypes.bool,
isInitialized: PropTypes.bool,
isUnlocked: PropTypes.bool,
optInMetaMetrics: PropTypes.bool,
}
render () {
const {
completedOnboarding,
isInitialized,
isUnlocked,
optInMetaMetrics,
} = this.props
if (completedOnboarding) {
return <Redirect to={{ pathname: DEFAULT_ROUTE }} />
}
if (isUnlocked) {
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 (optInMetaMetrics === null) {
return <Redirect to={{ pathname: INITIALIZE_WELCOME_ROUTE }} />
}
return <Redirect to={{ pathname: INITIALIZE_METAMETRICS_OPT_IN_ROUTE }} />
}
}