mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Add send screen template
This commit is contained in:
parent
293ca6c9a6
commit
f5b0d56b9d
@ -84,7 +84,7 @@
|
|||||||
"message": "Coinbase is the world’s most popular way to buy and sell bitcoin, ethereum, and litecoin."
|
"message": "Coinbase is the world’s most popular way to buy and sell bitcoin, ethereum, and litecoin."
|
||||||
},
|
},
|
||||||
"ok": {
|
"ok": {
|
||||||
message: "Ok"
|
"message": "Ok"
|
||||||
},
|
},
|
||||||
"cancel": {
|
"cancel": {
|
||||||
"message": "Cancel"
|
"message": "Cancel"
|
||||||
@ -282,6 +282,9 @@
|
|||||||
"from": {
|
"from": {
|
||||||
"message": "From"
|
"message": "From"
|
||||||
},
|
},
|
||||||
|
"to": {
|
||||||
|
"message": "To: "
|
||||||
|
},
|
||||||
"fromToSame": {
|
"fromToSame": {
|
||||||
"message": "From and To address cannot be the same"
|
"message": "From and To address cannot be the same"
|
||||||
},
|
},
|
||||||
@ -412,6 +415,9 @@
|
|||||||
"knowledgeDataBase": {
|
"knowledgeDataBase": {
|
||||||
"message": "Visit our Knowledge Base"
|
"message": "Visit our Knowledge Base"
|
||||||
},
|
},
|
||||||
|
"max": {
|
||||||
|
"message": "Max"
|
||||||
|
},
|
||||||
"lessThanMax": {
|
"lessThanMax": {
|
||||||
"message": "must be less than or equal to $1.",
|
"message": "must be less than or equal to $1.",
|
||||||
"description": "helper for inputting hex as decimal input"
|
"description": "helper for inputting hex as decimal input"
|
||||||
@ -684,9 +690,15 @@
|
|||||||
"sendTokens": {
|
"sendTokens": {
|
||||||
"message": "Send Tokens"
|
"message": "Send Tokens"
|
||||||
},
|
},
|
||||||
|
"onlySendToEtherAddress": {
|
||||||
|
"message": "Only send to an Ethereum address."
|
||||||
|
},
|
||||||
"sendTokensAnywhere": {
|
"sendTokensAnywhere": {
|
||||||
"message": "Send Tokens to anyone with an Ethereum account"
|
"message": "Send Tokens to anyone with an Ethereum account"
|
||||||
},
|
},
|
||||||
|
"required": {
|
||||||
|
"Required"
|
||||||
|
},
|
||||||
"settings": {
|
"settings": {
|
||||||
"message": "Settings"
|
"message": "Settings"
|
||||||
},
|
},
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
const { inherits } = require('util')
|
const { inherits } = require('util')
|
||||||
const PersistentForm = require('../lib/persistent-form')
|
const PersistentForm = require('../lib/persistent-form')
|
||||||
const h = require('react-hyperscript')
|
const h = require('react-hyperscript')
|
||||||
|
const t = require('../i18n')
|
||||||
|
|
||||||
const ethAbi = require('ethereumjs-abi')
|
const ethAbi = require('ethereumjs-abi')
|
||||||
const ethUtil = require('ethereumjs-util')
|
const ethUtil = require('ethereumjs-util')
|
||||||
@ -180,13 +181,12 @@ SendTransactionScreen.prototype.componentDidUpdate = function (prevProps) {
|
|||||||
|
|
||||||
SendTransactionScreen.prototype.renderHeader = function () {
|
SendTransactionScreen.prototype.renderHeader = function () {
|
||||||
const { selectedToken, clearSend, goHome } = this.props
|
const { selectedToken, clearSend, goHome } = this.props
|
||||||
const tokenText = selectedToken ? 'tokens' : 'ETH'
|
|
||||||
|
|
||||||
return h('div.page-container__header', [
|
return h('div.page-container__header', [
|
||||||
|
|
||||||
h('div.page-container__title', selectedToken ? 'Send Tokens' : 'Send ETH'),
|
h('div.page-container__title', selectedToken ? t('sendTokens') : t('sendETH')),
|
||||||
|
|
||||||
h('div.page-container__subtitle', `Only send ${tokenText} to an Ethereum address.`),
|
h('div.page-container__subtitle', t('onlySendToEtherAddress')),
|
||||||
|
|
||||||
h('div.page-container__header-close', {
|
h('div.page-container__header-close', {
|
||||||
onClick: () => {
|
onClick: () => {
|
||||||
@ -257,11 +257,11 @@ SendTransactionScreen.prototype.handleToChange = function (to) {
|
|||||||
let toError = null
|
let toError = null
|
||||||
|
|
||||||
if (!to) {
|
if (!to) {
|
||||||
toError = 'Required'
|
toError = t('required')
|
||||||
} else if (!isValidAddress(to)) {
|
} else if (!isValidAddress(to)) {
|
||||||
toError = 'Recipient address is invalid'
|
toError = t('invalidAddressRecipient')
|
||||||
} else if (to === from) {
|
} else if (to === from) {
|
||||||
toError = 'From and To address cannot be the same'
|
toError = t('fromToSame')
|
||||||
}
|
}
|
||||||
|
|
||||||
updateSendTo(to)
|
updateSendTo(to)
|
||||||
@ -277,9 +277,9 @@ SendTransactionScreen.prototype.renderToRow = function () {
|
|||||||
|
|
||||||
h('div.send-v2__form-label', [
|
h('div.send-v2__form-label', [
|
||||||
|
|
||||||
'To:',
|
t('to'),
|
||||||
|
|
||||||
this.renderErrorMessage('to'),
|
this.renderErrorMessage(t('to')),
|
||||||
|
|
||||||
]),
|
]),
|
||||||
|
|
||||||
@ -377,11 +377,11 @@ SendTransactionScreen.prototype.validateAmount = function (value) {
|
|||||||
)
|
)
|
||||||
|
|
||||||
if (conversionRate && !sufficientBalance) {
|
if (conversionRate && !sufficientBalance) {
|
||||||
amountError = 'Insufficient funds.'
|
amountError = t('insufficientFunds')
|
||||||
} else if (verifyTokenBalance && !sufficientTokens) {
|
} else if (verifyTokenBalance && !sufficientTokens) {
|
||||||
amountError = 'Insufficient tokens.'
|
amountError = t('insufficientTokens')
|
||||||
} else if (amountLessThanZero) {
|
} else if (amountLessThanZero) {
|
||||||
amountError = 'Can not send negative amounts of ETH.'
|
amountError = t('negativeETH')
|
||||||
}
|
}
|
||||||
|
|
||||||
updateSendErrors({ amount: amountError })
|
updateSendErrors({ amount: amountError })
|
||||||
@ -411,7 +411,7 @@ SendTransactionScreen.prototype.renderAmountRow = function () {
|
|||||||
setMaxModeTo(true)
|
setMaxModeTo(true)
|
||||||
this.setAmountToMax()
|
this.setAmountToMax()
|
||||||
},
|
},
|
||||||
}, [ !maxModeOn ? 'Max' : '' ]),
|
}, [ !maxModeOn ? t('max') : '' ]),
|
||||||
]),
|
]),
|
||||||
|
|
||||||
h('div.send-v2__form-field', [
|
h('div.send-v2__form-field', [
|
||||||
@ -439,7 +439,7 @@ SendTransactionScreen.prototype.renderGasRow = function () {
|
|||||||
|
|
||||||
return h('div.send-v2__form-row', [
|
return h('div.send-v2__form-row', [
|
||||||
|
|
||||||
h('div.send-v2__form-label', 'Gas fee:'),
|
h('div.send-v2__form-label', h('gasFee')),
|
||||||
|
|
||||||
h('div.send-v2__form-field', [
|
h('div.send-v2__form-field', [
|
||||||
|
|
||||||
@ -507,11 +507,11 @@ SendTransactionScreen.prototype.renderFooter = function () {
|
|||||||
clearSend()
|
clearSend()
|
||||||
goHome()
|
goHome()
|
||||||
},
|
},
|
||||||
}, 'Cancel'),
|
}, t('cancel')),
|
||||||
h('button.btn-clear.page-container__footer-button', {
|
h('button.btn-clear.page-container__footer-button', {
|
||||||
disabled: !noErrors || !gasTotal || missingTokenBalance,
|
disabled: !noErrors || !gasTotal || missingTokenBalance,
|
||||||
onClick: event => this.onSubmit(event),
|
onClick: event => this.onSubmit(event),
|
||||||
}, 'Next'),
|
}, t('next')),
|
||||||
])
|
])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user