2019-02-27 15:46:41 +01:00
|
|
|
import React, { PureComponent } from 'react'
|
|
|
|
import PropTypes from 'prop-types'
|
2019-03-22 00:03:30 +01:00
|
|
|
import Button from '../../../components/ui/button'
|
2019-11-22 18:03:51 +01:00
|
|
|
import Snackbar from '../../../components/ui/snackbar'
|
2019-07-09 19:17:58 +02:00
|
|
|
import MetaFoxLogo from '../../../components/ui/metafox-logo'
|
2019-03-22 00:03:30 +01:00
|
|
|
import { DEFAULT_ROUTE } from '../../../helpers/constants/routes'
|
2019-11-22 18:03:51 +01:00
|
|
|
import { returnToOnboardingInitiator } from '../onboarding-initiator-util'
|
2019-02-27 15:46:41 +01:00
|
|
|
|
|
|
|
export default class EndOfFlowScreen extends PureComponent {
|
|
|
|
static contextTypes = {
|
|
|
|
t: PropTypes.func,
|
2019-03-05 16:45:01 +01:00
|
|
|
metricsEvent: PropTypes.func,
|
2019-02-27 15:46:41 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static propTypes = {
|
|
|
|
history: PropTypes.object,
|
2019-03-05 16:45:01 +01:00
|
|
|
completionMetaMetricsName: PropTypes.string,
|
2019-11-22 18:03:51 +01:00
|
|
|
onboardingInitiator: PropTypes.exact({
|
|
|
|
location: PropTypes.string,
|
|
|
|
tabId: PropTypes.number,
|
|
|
|
}),
|
|
|
|
}
|
|
|
|
|
|
|
|
onComplete = async () => {
|
2020-07-27 23:03:26 +02:00
|
|
|
const { history, completionMetaMetricsName, onboardingInitiator } = this.props
|
2019-11-22 18:03:51 +01:00
|
|
|
|
|
|
|
this.context.metricsEvent({
|
|
|
|
eventOpts: {
|
|
|
|
category: 'Onboarding',
|
|
|
|
action: 'Onboarding Complete',
|
|
|
|
name: completionMetaMetricsName,
|
|
|
|
},
|
|
|
|
})
|
|
|
|
|
|
|
|
if (onboardingInitiator) {
|
|
|
|
await returnToOnboardingInitiator(onboardingInitiator)
|
|
|
|
}
|
|
|
|
history.push(DEFAULT_ROUTE)
|
2019-02-27 15:46:41 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
render () {
|
|
|
|
const { t } = this.context
|
2019-11-22 18:03:51 +01:00
|
|
|
const { onboardingInitiator } = this.props
|
2019-02-27 15:46:41 +01:00
|
|
|
|
|
|
|
return (
|
|
|
|
<div className="end-of-flow">
|
2019-07-09 19:17:58 +02:00
|
|
|
<MetaFoxLogo />
|
2019-02-27 15:46:41 +01:00
|
|
|
<div className="end-of-flow__emoji">🎉</div>
|
|
|
|
<div className="first-time-flow__header">
|
|
|
|
{ t('congratulations') }
|
|
|
|
</div>
|
|
|
|
<div className="first-time-flow__text-block end-of-flow__text-1">
|
|
|
|
{ t('endOfFlowMessage1') }
|
|
|
|
</div>
|
|
|
|
<div className="first-time-flow__text-block end-of-flow__text-2">
|
|
|
|
{ t('endOfFlowMessage2') }
|
|
|
|
</div>
|
2019-03-05 16:45:01 +01:00
|
|
|
<div className="end-of-flow__text-3">
|
2019-02-27 15:46:41 +01:00
|
|
|
{ '• ' + t('endOfFlowMessage3') }
|
|
|
|
</div>
|
2019-03-05 16:45:01 +01:00
|
|
|
<div className="end-of-flow__text-3">
|
2019-02-27 15:46:41 +01:00
|
|
|
{ '• ' + t('endOfFlowMessage4') }
|
|
|
|
</div>
|
2019-03-05 16:45:01 +01:00
|
|
|
<div className="end-of-flow__text-3">
|
|
|
|
{ '• ' + t('endOfFlowMessage5') }
|
|
|
|
</div>
|
|
|
|
<div className="end-of-flow__text-3">
|
|
|
|
{ '• ' + t('endOfFlowMessage6') }
|
2019-02-27 15:46:41 +01:00
|
|
|
</div>
|
2019-03-05 16:45:01 +01:00
|
|
|
<div className="end-of-flow__text-3">
|
|
|
|
{ '• ' + t('endOfFlowMessage7') }
|
|
|
|
</div>
|
|
|
|
<div className="first-time-flow__text-block end-of-flow__text-4">
|
2019-12-03 17:35:44 +01:00
|
|
|
{ '*' + t('endOfFlowMessage8') }
|
|
|
|
<a
|
2019-03-05 16:45:01 +01:00
|
|
|
href="https://metamask.zendesk.com/hc/en-us/articles/360015489591-Basic-Safety-Tips"
|
|
|
|
target="_blank"
|
|
|
|
rel="noopener noreferrer"
|
|
|
|
>
|
|
|
|
<span className="first-time-flow__link-text">
|
2019-07-15 04:22:20 +02:00
|
|
|
{t('endOfFlowMessage9')}
|
2019-03-05 16:45:01 +01:00
|
|
|
</span>
|
2019-07-15 18:48:44 +02:00
|
|
|
</a>
|
2019-02-27 15:46:41 +01:00
|
|
|
</div>
|
|
|
|
<Button
|
2019-04-16 21:35:22 +02:00
|
|
|
type="primary"
|
2019-02-27 15:46:41 +01:00
|
|
|
className="first-time-flow__button"
|
2019-11-22 18:03:51 +01:00
|
|
|
onClick={this.onComplete}
|
2019-02-27 15:46:41 +01:00
|
|
|
>
|
2019-07-15 04:22:20 +02:00
|
|
|
{ t('endOfFlowMessage10') }
|
2019-02-27 15:46:41 +01:00
|
|
|
</Button>
|
2019-11-22 18:03:51 +01:00
|
|
|
{
|
2019-12-03 17:35:44 +01:00
|
|
|
onboardingInitiator ? (
|
2019-11-22 18:03:51 +01:00
|
|
|
<Snackbar
|
|
|
|
content={t('onboardingReturnNotice', [t('endOfFlowMessage10'), onboardingInitiator.location])}
|
2019-12-03 17:35:44 +01:00
|
|
|
/>
|
|
|
|
) : null
|
2019-11-22 18:03:51 +01:00
|
|
|
}
|
2019-02-27 15:46:41 +01:00
|
|
|
</div>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|