1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-10-24 04:13:27 +02:00
metamask-extension/ui/app/components/pages/create-account/connect-hardware/connect-screen.js

56 lines
1.6 KiB
JavaScript
Raw Normal View History

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', {}, [
h('div.hw-unsupported-browser', [
h('h3.hw-unsupported-browser__title', {}, this.context.t('browserNotSupported')),
h('p.hw-unsupported-browser__msg', {}, this.context.t('chromeRequiredForTrezor')),
]),
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
)
}
renderConnectButton () {
2018-07-06 02:59:31 +02:00
return h(
'button.btn-primary.btn--large',
{ onClick: this.props.connectToTrezor.bind(this), style: { margin: 12 } },
this.props.btnText
)
2018-07-05 23:45:28 +02:00
}
render () {
const isChrome = window.navigator.userAgent.search('Chrome') !== -1
if (isChrome) {
return this.renderConnectButton()
}
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