2018-07-05 23:45:28 +02:00
|
|
|
const { Component } = require('react')
|
|
|
|
const PropTypes = require('prop-types')
|
|
|
|
const h = require('react-hyperscript')
|
|
|
|
|
2018-07-06 02:59:31 +02:00
|
|
|
class ConnectScreen extends Component {
|
2018-07-05 23:45:28 +02:00
|
|
|
constructor (props, context) {
|
|
|
|
super(props)
|
|
|
|
}
|
|
|
|
|
|
|
|
renderUnsupportedBrowser () {
|
|
|
|
return (
|
2018-07-06 02:59:31 +02:00
|
|
|
h('div', {}, [
|
2018-07-07 02:04:20 +02:00
|
|
|
h('div.hw-connect', [
|
|
|
|
h('h3.hw-connect__title', {}, this.context.t('browserNotSupported')),
|
|
|
|
h('p.hw-connect__msg', {}, this.context.t('chromeRequiredForTrezor')),
|
2018-07-06 02:59:31 +02:00
|
|
|
]),
|
|
|
|
h(
|
|
|
|
'button.btn-primary.btn--large',
|
|
|
|
{ onClick: () => global.platform.openWindow({
|
|
|
|
url: 'https://google.com/chrome',
|
|
|
|
}), style: { margin: 12 } },
|
|
|
|
this.context.t('downloadGoogleChrome')
|
|
|
|
),
|
|
|
|
])
|
2018-07-05 23:45:28 +02:00
|
|
|
)
|
|
|
|
}
|
|
|
|
|
2018-07-07 02:04:20 +02:00
|
|
|
renderConnectScreen () {
|
|
|
|
return (
|
|
|
|
h('div', {}, [
|
|
|
|
h('div.hw-connect', [
|
|
|
|
h('h3.hw-connect__title', {}, this.context.t('trezorHardwareWallet')),
|
|
|
|
h('p.hw-connect__msg', {}, this.context.t('connectToTrezorHelp')),
|
|
|
|
h('p.hw-connect__msg', {}, [
|
|
|
|
this.context.t('connectToTrezorTrouble'),
|
2018-07-07 02:37:08 +02:00
|
|
|
h('a.hw-connect__link', {
|
|
|
|
href: 'https://support.metamask.io/',
|
|
|
|
target: '_blank',
|
|
|
|
}, ` ${this.context.t('learnMore')}`),
|
2018-07-07 02:04:20 +02:00
|
|
|
]),
|
|
|
|
]),
|
|
|
|
h(
|
2018-07-06 02:59:31 +02:00
|
|
|
'button.btn-primary.btn--large',
|
2018-07-07 02:04:20 +02:00
|
|
|
{ onClick: this.props.connectToTrezor.bind(this) },
|
2018-07-06 02:59:31 +02:00
|
|
|
this.props.btnText
|
2018-07-07 02:04:20 +02:00
|
|
|
),
|
|
|
|
])
|
|
|
|
)
|
2018-07-05 23:45:28 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
render () {
|
|
|
|
const isChrome = window.navigator.userAgent.search('Chrome') !== -1
|
|
|
|
if (isChrome) {
|
2018-07-07 02:04:20 +02:00
|
|
|
return this.renderConnectScreen()
|
2018-07-05 23:45:28 +02:00
|
|
|
}
|
2018-07-06 02:59:31 +02:00
|
|
|
return this.renderUnsupportedBrowser()
|
2018-07-05 23:45:28 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ConnectScreen.propTypes = {
|
|
|
|
connectToTrezor: PropTypes.func.isRequired,
|
|
|
|
btnText: PropTypes.string,
|
|
|
|
}
|
|
|
|
|
|
|
|
ConnectScreen.contextTypes = {
|
|
|
|
t: PropTypes.func,
|
|
|
|
}
|
2018-07-06 02:59:31 +02:00
|
|
|
|
|
|
|
module.exports = ConnectScreen
|
|
|
|
|