mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-25 11:28:51 +01:00
70386726f6
* Added Flask Experimental Area warning to OnboardingV2 * Added first time flow Flask Experimental Area warning * Made both onboarding flows use one Experimental Area component * Fix comments in React divs * Fix unreachable code * Fix build lint problems * Changes after code review * Added guards around route constants imports * Code Review changes * Update ui/components/app/flask/experimental-area/index.scss Co-authored-by: George Marshall <george.marshall@consensys.net> * Code review changes * Fix lint * Update ui/components/app/flask/experimental-area/index.scss Co-authored-by: George Marshall <george.marshall@consensys.net> * Update ui/components/app/flask/experimental-area/index.scss Co-authored-by: George Marshall <george.marshall@consensys.net> * Update ui/components/app/flask/experimental-area/index.scss Co-authored-by: George Marshall <george.marshall@consensys.net> * Update ui/components/app/flask/experimental-area/index.scss Co-authored-by: George Marshall <george.marshall@consensys.net> * Update ui/components/app/flask/experimental-area/index.scss Co-authored-by: George Marshall <george.marshall@consensys.net> * fix lint Co-authored-by: George Marshall <george.marshall@consensys.net>
61 lines
1.6 KiB
JavaScript
61 lines
1.6 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_UNLOCK_ROUTE,
|
|
///: BEGIN:ONLY_INCLUDE_IN(flask)
|
|
INITIALIZE_EXPERIMENTAL_AREA,
|
|
///: END:ONLY_INCLUDE_IN
|
|
///: BEGIN:ONLY_INCLUDE_IN(main,beta)
|
|
INITIALIZE_WELCOME_ROUTE,
|
|
///: END:ONLY_INCLUDE_IN
|
|
} 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) {
|
|
/* eslint-disable prefer-const */
|
|
let redirect;
|
|
///: BEGIN:ONLY_INCLUDE_IN(flask)
|
|
redirect = <Redirect to={{ pathname: INITIALIZE_EXPERIMENTAL_AREA }} />;
|
|
///: END:ONLY_INCLUDE_IN
|
|
///: BEGIN:ONLY_INCLUDE_IN(main,beta)
|
|
redirect = <Redirect to={{ pathname: INITIALIZE_WELCOME_ROUTE }} />;
|
|
///: END:ONLY_INCLUDE_IN
|
|
/* eslint-enable prefer-const */
|
|
return redirect;
|
|
}
|
|
|
|
return <Redirect to={{ pathname: INITIALIZE_UNLOCK_ROUTE }} />;
|
|
}
|
|
}
|