2019-01-23 16:25:34 +01:00
|
|
|
import EventEmitter from 'events'
|
|
|
|
import React, { PureComponent } from 'react'
|
|
|
|
import PropTypes from 'prop-types'
|
2019-03-22 00:03:30 +01:00
|
|
|
import Mascot from '../../../components/ui/mascot'
|
|
|
|
import Button from '../../../components/ui/button'
|
2020-11-03 00:41:28 +01:00
|
|
|
import {
|
|
|
|
INITIALIZE_CREATE_PASSWORD_ROUTE,
|
|
|
|
INITIALIZE_SELECT_ACTION_ROUTE,
|
|
|
|
} from '../../../helpers/constants/routes'
|
2019-01-23 16:25:34 +01:00
|
|
|
|
|
|
|
export default class Welcome extends PureComponent {
|
|
|
|
static propTypes = {
|
|
|
|
history: PropTypes.object,
|
2019-03-05 16:45:01 +01:00
|
|
|
participateInMetaMetrics: PropTypes.bool,
|
|
|
|
welcomeScreenSeen: PropTypes.bool,
|
2019-01-23 16:25:34 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static contextTypes = {
|
|
|
|
t: PropTypes.func,
|
|
|
|
}
|
|
|
|
|
2020-11-03 00:41:28 +01:00
|
|
|
constructor(props) {
|
2019-01-23 16:25:34 +01:00
|
|
|
super(props)
|
|
|
|
|
|
|
|
this.animationEventEmitter = new EventEmitter()
|
|
|
|
}
|
|
|
|
|
2020-11-03 00:41:28 +01:00
|
|
|
componentDidMount() {
|
2019-03-05 16:45:01 +01:00
|
|
|
const { history, participateInMetaMetrics, welcomeScreenSeen } = this.props
|
2019-01-23 16:25:34 +01:00
|
|
|
|
2019-03-05 16:45:01 +01:00
|
|
|
if (welcomeScreenSeen && participateInMetaMetrics !== null) {
|
|
|
|
history.push(INITIALIZE_CREATE_PASSWORD_ROUTE)
|
|
|
|
} else if (welcomeScreenSeen) {
|
|
|
|
history.push(INITIALIZE_SELECT_ACTION_ROUTE)
|
2019-01-23 16:25:34 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
handleContinue = () => {
|
2019-02-27 15:46:41 +01:00
|
|
|
this.props.history.push(INITIALIZE_SELECT_ACTION_ROUTE)
|
2019-01-23 16:25:34 +01:00
|
|
|
}
|
|
|
|
|
2020-11-03 00:41:28 +01:00
|
|
|
render() {
|
2019-01-23 16:25:34 +01:00
|
|
|
const { t } = this.context
|
|
|
|
|
|
|
|
return (
|
|
|
|
<div className="welcome-page__wrapper">
|
|
|
|
<div className="welcome-page">
|
|
|
|
<Mascot
|
|
|
|
animationEventEmitter={this.animationEventEmitter}
|
2019-02-27 15:46:41 +01:00
|
|
|
width="125"
|
|
|
|
height="125"
|
2019-01-23 16:25:34 +01:00
|
|
|
/>
|
2020-11-03 00:41:28 +01:00
|
|
|
<div className="welcome-page__header">{t('welcome')}</div>
|
2019-01-23 16:25:34 +01:00
|
|
|
<div className="welcome-page__description">
|
2020-11-03 00:41:28 +01:00
|
|
|
<div>{t('metamaskDescription')}</div>
|
|
|
|
<div>{t('happyToSeeYou')}</div>
|
2019-01-23 16:25:34 +01:00
|
|
|
</div>
|
|
|
|
<Button
|
2019-04-16 21:35:22 +02:00
|
|
|
type="primary"
|
2019-01-23 16:25:34 +01:00
|
|
|
className="first-time-flow__button"
|
|
|
|
onClick={this.handleContinue}
|
|
|
|
>
|
2020-11-03 00:41:28 +01:00
|
|
|
{t('getStarted')}
|
2019-01-23 16:25:34 +01:00
|
|
|
</Button>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|