1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00

Convert ConfirmTxScreen component to use JSX (#7559)

This commit is contained in:
Whymarrh Whitby 2019-11-25 10:03:30 -03:30 committed by GitHub
parent caefda5f47
commit 921134bad1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,6 +1,5 @@
import React, {Component} from 'react'
const inherits = require('util').inherits const inherits = require('util').inherits
const Component = require('react').Component
const h = require('react-hyperscript')
const connect = require('react-redux').connect const connect = require('react-redux').connect
const { withRouter } = require('react-router-dom') const { withRouter } = require('react-router-dom')
const { compose } = require('recompose') const { compose } = require('recompose')
@ -148,35 +147,41 @@ ConfirmTxScreen.prototype.signatureSelect = function (type, version) {
} }
ConfirmTxScreen.prototype.render = function () { ConfirmTxScreen.prototype.render = function () {
const props = this.props
const { const {
currentCurrency, currentCurrency,
blockGasLimit, blockGasLimit,
conversionRate, conversionRate,
} = props } = this.props
var txData = this.getTxData() || {} var txData = this.getTxData() || {}
const { msgParams, type, msgParams: { version } } = txData const { msgParams, type, msgParams: { version } } = txData
log.debug('msgParams detected, rendering pending msg') log.debug('msgParams detected, rendering pending msg')
return msgParams ? h(this.signatureSelect(type, version), { if (!msgParams) {
// Properties return (
txData: txData, <Loading />
key: txData.id, )
selectedAddress: props.selectedAddress, }
accounts: props.accounts,
identities: props.identities, const SigComponent = this.signatureSelect(type, version)
conversionRate, return (
currentCurrency, <SigComponent
blockGasLimit, txData={txData}
// Actions key={txData.id}
signMessage: this.signMessage.bind(this, txData), selectedAddress={this.props.selectedAddress}
signPersonalMessage: this.signPersonalMessage.bind(this, txData), accounts={this.props.accounts}
signTypedMessage: this.signTypedMessage.bind(this, txData), identities={this.props.identities}
cancelMessage: this.cancelMessage.bind(this, txData), conversionRate={conversionRate}
cancelPersonalMessage: this.cancelPersonalMessage.bind(this, txData), currentCurrency={currentCurrency}
cancelTypedMessage: this.cancelTypedMessage.bind(this, txData), blockGasLimit={blockGasLimit}
}) : h(Loading) signMessage={this.signMessage.bind(this, txData)}
signPersonalMessage={this.signPersonalMessage.bind(this, txData)}
signTypedMessage={this.signTypedMessage.bind(this, txData)}
cancelMessage={this.cancelMessage.bind(this, txData)}
cancelPersonalMessage={this.cancelPersonalMessage.bind(this, txData)}
cancelTypedMessage={this.cancelTypedMessage.bind(this, txData)}
/>
)
} }
ConfirmTxScreen.prototype.signMessage = function (msgData, event) { ConfirmTxScreen.prototype.signMessage = function (msgData, event) {