mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-02 14:15:06 +01:00
c2218ad941
* Convert Confirm Page Container test to tlr. Add test ids to associated components. * Convert Welcome component to tlr. * Update ui/pages/first-time-flow/welcome/welcome.test.js Co-authored-by: Ariella Vu <20778143+digiwand@users.noreply.github.com> * Update ui/components/app/confirm-page-container/confirm-page-container-container.test.js Co-authored-by: Ariella Vu <20778143+digiwand@users.noreply.github.com> * Remove unsused, commented out, lines Co-authored-by: Ariella Vu <20778143+digiwand@users.noreply.github.com>
83 lines
2.2 KiB
JavaScript
83 lines
2.2 KiB
JavaScript
import EventEmitter from 'events';
|
|
import React, { PureComponent } from 'react';
|
|
import PropTypes from 'prop-types';
|
|
import Mascot from '../../../components/ui/mascot';
|
|
import Button from '../../../components/ui/button';
|
|
import {
|
|
INITIALIZE_CREATE_PASSWORD_ROUTE,
|
|
INITIALIZE_SELECT_ACTION_ROUTE,
|
|
INITIALIZE_METAMETRICS_OPT_IN_ROUTE,
|
|
} from '../../../helpers/constants/routes';
|
|
import { isBeta } from '../../../helpers/utils/build-types';
|
|
import WelcomeFooter from './welcome-footer.component';
|
|
import BetaWelcomeFooter from './beta-welcome-footer.component';
|
|
|
|
export default class Welcome extends PureComponent {
|
|
static propTypes = {
|
|
history: PropTypes.object,
|
|
participateInMetaMetrics: PropTypes.bool,
|
|
welcomeScreenSeen: PropTypes.bool,
|
|
isInitialized: PropTypes.bool,
|
|
};
|
|
|
|
static contextTypes = {
|
|
t: PropTypes.func,
|
|
};
|
|
|
|
constructor(props) {
|
|
super(props);
|
|
|
|
this.animationEventEmitter = new EventEmitter();
|
|
}
|
|
|
|
componentDidMount() {
|
|
const {
|
|
history,
|
|
participateInMetaMetrics,
|
|
welcomeScreenSeen,
|
|
isInitialized,
|
|
} = this.props;
|
|
|
|
if (
|
|
welcomeScreenSeen &&
|
|
isInitialized &&
|
|
participateInMetaMetrics !== null
|
|
) {
|
|
history.push(INITIALIZE_CREATE_PASSWORD_ROUTE);
|
|
} else if (welcomeScreenSeen && participateInMetaMetrics !== null) {
|
|
history.push(INITIALIZE_SELECT_ACTION_ROUTE);
|
|
} else if (welcomeScreenSeen) {
|
|
history.push(INITIALIZE_METAMETRICS_OPT_IN_ROUTE);
|
|
}
|
|
}
|
|
|
|
handleContinue = () => {
|
|
this.props.history.push(INITIALIZE_METAMETRICS_OPT_IN_ROUTE);
|
|
};
|
|
|
|
render() {
|
|
const { t } = this.context;
|
|
|
|
return (
|
|
<div className="welcome-page__wrapper">
|
|
<div className="welcome-page">
|
|
<Mascot
|
|
animationEventEmitter={this.animationEventEmitter}
|
|
width="125"
|
|
height="125"
|
|
/>
|
|
{isBeta() ? <BetaWelcomeFooter /> : <WelcomeFooter />}
|
|
<Button
|
|
type="primary"
|
|
className="first-time-flow__button"
|
|
onClick={this.handleContinue}
|
|
data-testid="first-time-flow__button"
|
|
>
|
|
{t('getStarted')}
|
|
</Button>
|
|
</div>
|
|
</div>
|
|
);
|
|
}
|
|
}
|