mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Convert ConnectHardwareForm component to JSX (#7517)
This commit is contained in:
parent
80badb10c1
commit
49dfb5ec2c
@ -1,6 +1,5 @@
|
|||||||
const { Component } = require('react')
|
import React, { Component } from 'react'
|
||||||
const PropTypes = require('prop-types')
|
const PropTypes = require('prop-types')
|
||||||
const h = require('react-hyperscript')
|
|
||||||
const connect = require('react-redux').connect
|
const connect = require('react-redux').connect
|
||||||
const actions = require('../../../store/actions')
|
const actions = require('../../../store/actions')
|
||||||
const { getMetaMaskAccounts } = require('../../../selectors/selectors')
|
const { getMetaMaskAccounts } = require('../../../selectors/selectors')
|
||||||
@ -176,40 +175,53 @@ class ConnectHardwareForm extends Component {
|
|||||||
|
|
||||||
renderError () {
|
renderError () {
|
||||||
return this.state.error
|
return this.state.error
|
||||||
? h('span.error', { style: { margin: '20px 20px 10px', display: 'block', textAlign: 'center' } }, this.state.error)
|
? (
|
||||||
|
<span
|
||||||
|
className="error"
|
||||||
|
style={{ margin: '20px 20px 10px', display: 'block', textAlign: 'center' }}
|
||||||
|
>
|
||||||
|
{this.state.error}
|
||||||
|
</span>
|
||||||
|
)
|
||||||
: null
|
: null
|
||||||
}
|
}
|
||||||
|
|
||||||
renderContent () {
|
renderContent () {
|
||||||
if (!this.state.accounts.length) {
|
if (!this.state.accounts.length) {
|
||||||
return h(ConnectScreen, {
|
return (
|
||||||
connectToHardwareWallet: this.connectToHardwareWallet,
|
<ConnectScreen
|
||||||
browserSupported: this.state.browserSupported,
|
connectToHardwareWallet={this.connectToHardwareWallet}
|
||||||
})
|
browserSupported={this.state.browserSupported}
|
||||||
|
/>
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
return h(AccountList, {
|
return (
|
||||||
onPathChange: this.onPathChange,
|
<AccountList
|
||||||
selectedPath: this.props.defaultHdPaths[this.state.device],
|
onPathChange={this.onPathChange}
|
||||||
device: this.state.device,
|
selectedPath={this.props.defaultHdPaths[this.state.device]}
|
||||||
accounts: this.state.accounts,
|
device={this.state.device}
|
||||||
selectedAccount: this.state.selectedAccount,
|
accounts={this.state.accounts}
|
||||||
onAccountChange: this.onAccountChange,
|
selectedAccount={this.state.selectedAccount}
|
||||||
network: this.props.network,
|
onAccountChange={this.onAccountChange}
|
||||||
getPage: this.getPage,
|
network={this.props.network}
|
||||||
history: this.props.history,
|
getPage={this.getPage}
|
||||||
onUnlockAccount: this.onUnlockAccount,
|
history={this.props.history}
|
||||||
onForgetDevice: this.onForgetDevice,
|
onUnlockAccount={this.onUnlockAccount}
|
||||||
onCancel: this.onCancel,
|
onForgetDevice={this.onForgetDevice}
|
||||||
onAccountRestriction: this.onAccountRestriction,
|
onCancel={this.onCancel}
|
||||||
})
|
onAccountRestriction={this.onAccountRestriction}
|
||||||
|
/>
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
render () {
|
render () {
|
||||||
return h('div', [
|
return (
|
||||||
this.renderError(),
|
<div>
|
||||||
this.renderContent(),
|
{this.renderError()}
|
||||||
])
|
{this.renderContent()}
|
||||||
|
</div>
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user