1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-30 16:18:07 +01:00
metamask-extension/ui/app/pages/first-time-flow/first-time-flow-switch/first-time-flow-switch.component.js
Erik Marks 76a2a9bb8b
@metamask/eslint config@5.0.0 (#10358)
* @metamask/eslint-config@5.0.0
* Update eslintrc and prettierrc
* yarn lint:fix
2021-02-04 10:15:23 -08:00

47 lines
1.1 KiB
JavaScript

import React, { PureComponent } from 'react';
import PropTypes from 'prop-types';
import { Redirect } from 'react-router-dom';
import {
DEFAULT_ROUTE,
LOCK_ROUTE,
INITIALIZE_END_OF_FLOW_ROUTE,
INITIALIZE_WELCOME_ROUTE,
INITIALIZE_UNLOCK_ROUTE,
} from '../../../helpers/constants/routes';
export default class FirstTimeFlowSwitch extends PureComponent {
static propTypes = {
completedOnboarding: PropTypes.bool,
isInitialized: PropTypes.bool,
isUnlocked: PropTypes.bool,
seedPhraseBackedUp: PropTypes.bool,
};
render() {
const {
completedOnboarding,
isInitialized,
isUnlocked,
seedPhraseBackedUp,
} = this.props;
if (completedOnboarding) {
return <Redirect to={{ pathname: DEFAULT_ROUTE }} />;
}
if (seedPhraseBackedUp !== null) {
return <Redirect to={{ pathname: INITIALIZE_END_OF_FLOW_ROUTE }} />;
}
if (isUnlocked) {
return <Redirect to={{ pathname: LOCK_ROUTE }} />;
}
if (!isInitialized) {
return <Redirect to={{ pathname: INITIALIZE_WELCOME_ROUTE }} />;
}
return <Redirect to={{ pathname: INITIALIZE_UNLOCK_ROUTE }} />;
}
}