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

79 lines
2.5 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', {}, [
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',
}),
},
2018-07-06 02:59:31 +02:00
this.context.t('downloadGoogleChrome')
),
])
2018-07-05 23:45:28 +02:00
)
}
2018-07-07 02:04:20 +02:00
renderConnectScreen () {
return (
h('div.new-account-connect-form', {}, [
2018-07-07 02:04:20 +02:00
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-13 19:49:20 +02:00
h('div.hw-connect__get-trezor', {}, [
h('a', {
href: 'https://shop.trezor.io/?a=metamask',
target: '_blank',
}, this.context.t('getYourTrezor')),
]),
2018-07-07 02:04:20 +02:00
])
)
2018-07-05 23:45:28 +02:00
}
render () {
if (this.props.browserSupported) {
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.isRequired,
browserSupported: PropTypes.bool.isRequired,
2018-07-05 23:45:28 +02:00
}
ConnectScreen.contextTypes = {
t: PropTypes.func,
}
2018-07-06 02:59:31 +02:00
module.exports = ConnectScreen