aboutsummaryrefslogtreecommitdiffstats
path: root/ui/app/components
diff options
context:
space:
mode:
Diffstat (limited to 'ui/app/components')
-rw-r--r--ui/app/components/dropdowns/network-dropdown.js8
-rw-r--r--ui/app/components/identicon.js5
-rw-r--r--ui/app/components/pending-tx/confirm-send-ether.js52
-rw-r--r--ui/app/components/pending-tx/confirm-send-token.js53
4 files changed, 95 insertions, 23 deletions
diff --git a/ui/app/components/dropdowns/network-dropdown.js b/ui/app/components/dropdowns/network-dropdown.js
index 94e5d967b..9e47f38ef 100644
--- a/ui/app/components/dropdowns/network-dropdown.js
+++ b/ui/app/components/dropdowns/network-dropdown.js
@@ -203,18 +203,18 @@ NetworkDropdown.prototype.render = function () {
{
key: 'default',
closeMenu: () => this.props.hideNetworkDropdown(),
- onClick: () => props.setRpcTarget('http://localhost:8545'),
+ onClick: () => props.setProviderType('localhost'),
style: dropdownMenuItemStyle,
},
[
- activeNetwork === 'http://localhost:8545' ? h('i.fa.fa-check') : h('.network-check__transparent', '✓'),
+ providerType === 'localhost' ? h('i.fa.fa-check') : h('.network-check__transparent', '✓'),
h(NetworkDropdownIcon, {
- isSelected: activeNetwork === 'http://localhost:8545',
+ isSelected: providerType === 'localhost',
innerBorder: '1px solid #9b9b9b',
}),
h('span.network-name-item', {
style: {
- color: activeNetwork === 'http://localhost:8545' ? '#ffffff' : '#9b9b9b',
+ color: providerType === 'localhost' ? '#ffffff' : '#9b9b9b',
},
}, this.context.t('localhost')),
]
diff --git a/ui/app/components/identicon.js b/ui/app/components/identicon.js
index 7cc5a4de0..dce9b0449 100644
--- a/ui/app/components/identicon.js
+++ b/ui/app/components/identicon.js
@@ -105,9 +105,8 @@ IdenticonComponent.prototype.componentDidUpdate = function () {
function _generateBlockie (container, address, diameter) {
const img = new Image()
img.src = toDataUrl(address)
- const dia = !diameter || diameter < 50 ? 50 : diameter
- img.height = dia * 1.25
- img.width = dia * 1.25
+ img.height = diameter
+ img.width = diameter
container.appendChild(img)
}
diff --git a/ui/app/components/pending-tx/confirm-send-ether.js b/ui/app/components/pending-tx/confirm-send-ether.js
index 2474516d4..d007e6661 100644
--- a/ui/app/components/pending-tx/confirm-send-ether.js
+++ b/ui/app/components/pending-tx/confirm-send-ether.js
@@ -109,16 +109,50 @@ function ConfirmSendEther () {
this.onSubmit = this.onSubmit.bind(this)
}
-ConfirmSendEther.prototype.componentWillMount = function () {
- const { updateSendErrors } = this.props
+ConfirmSendEther.prototype.updateComponentSendErrors = function (prevProps) {
+ const {
+ balance: oldBalance,
+ conversionRate: oldConversionRate,
+ } = prevProps
+ const {
+ updateSendErrors,
+ balance,
+ conversionRate,
+ send: {
+ errors: {
+ simulationFails,
+ },
+ },
+ } = this.props
const txMeta = this.gatherTxMeta()
- const balanceIsSufficient = this.isBalanceSufficient(txMeta)
- updateSendErrors({
- insufficientFunds: balanceIsSufficient
- ? false
- : this.context.t('insufficientFunds'),
- })
+ const shouldUpdateBalanceSendErrors = balance && [
+ balance !== oldBalance,
+ conversionRate !== oldConversionRate,
+ ].some(x => Boolean(x))
+
+ if (shouldUpdateBalanceSendErrors) {
+ const balanceIsSufficient = this.isBalanceSufficient(txMeta)
+ updateSendErrors({
+ insufficientFunds: balanceIsSufficient ? false : this.context.t('insufficientFunds'),
+ })
+ }
+
+ const shouldUpdateSimulationSendError = Boolean(txMeta.simulationFails) !== Boolean(simulationFails)
+
+ if (shouldUpdateSimulationSendError) {
+ updateSendErrors({
+ simulationFails: !txMeta.simulationFails ? false : this.context.t('transactionError'),
+ })
+ }
+}
+
+ConfirmSendEther.prototype.componentWillMount = function () {
+ this.updateComponentSendErrors({})
+}
+
+ConfirmSendEther.prototype.componentDidUpdate = function (prevProps) {
+ this.updateComponentSendErrors(prevProps)
}
ConfirmSendEther.prototype.getAmount = function () {
@@ -457,8 +491,10 @@ ConfirmSendEther.prototype.render = function () {
]),
h('form#pending-tx-form', {
+ className: 'confirm-screen-form',
onSubmit: this.onSubmit,
}, [
+ this.renderErrorMessage('simulationFails'),
h('.page-container__footer', [
// Cancel Button
h('button.btn-cancel.page-container__footer-button.allcaps', {
diff --git a/ui/app/components/pending-tx/confirm-send-token.js b/ui/app/components/pending-tx/confirm-send-token.js
index dd9fdc23f..19e591fd6 100644
--- a/ui/app/components/pending-tx/confirm-send-token.js
+++ b/ui/app/components/pending-tx/confirm-send-token.js
@@ -147,21 +147,56 @@ function ConfirmSendToken () {
this.onSubmit = this.onSubmit.bind(this)
}
-ConfirmSendToken.prototype.componentWillMount = function () {
- const { tokenContract, selectedAddress, updateSendErrors} = this.props
+ConfirmSendToken.prototype.updateComponentSendErrors = function (prevProps) {
+ const {
+ balance: oldBalance,
+ conversionRate: oldConversionRate,
+ } = prevProps
+ const {
+ updateSendErrors,
+ balance,
+ conversionRate,
+ send: {
+ errors: {
+ simulationFails,
+ },
+ },
+ } = this.props
const txMeta = this.gatherTxMeta()
- const balanceIsSufficient = this.isBalanceSufficient(txMeta)
+
+ const shouldUpdateBalanceSendErrors = balance && [
+ balance !== oldBalance,
+ conversionRate !== oldConversionRate,
+ ].some(x => Boolean(x))
+
+ if (shouldUpdateBalanceSendErrors) {
+ const balanceIsSufficient = this.isBalanceSufficient(txMeta)
+ updateSendErrors({
+ insufficientFunds: balanceIsSufficient ? false : this.context.t('insufficientFunds'),
+ })
+ }
+
+ const shouldUpdateSimulationSendError = Boolean(txMeta.simulationFails) !== Boolean(simulationFails)
+
+ if (shouldUpdateSimulationSendError) {
+ updateSendErrors({
+ simulationFails: !txMeta.simulationFails ? false : this.context.t('transactionError'),
+ })
+ }
+}
+
+ConfirmSendToken.prototype.componentWillMount = function () {
+ const { tokenContract, selectedAddress } = this.props
tokenContract && tokenContract
.balanceOf(selectedAddress)
.then(usersToken => {
})
this.props.updateTokenExchangeRate()
+ this.updateComponentSendErrors({})
+}
- updateSendErrors({
- insufficientFunds: balanceIsSufficient
- ? false
- : this.context.t('insufficientFunds'),
- })
+ConfirmSendToken.prototype.componentDidUpdate = function (prevProps) {
+ this.updateComponentSendErrors(prevProps)
}
ConfirmSendToken.prototype.getAmount = function () {
@@ -467,8 +502,10 @@ ConfirmSendToken.prototype.render = function () {
]),
h('form#pending-tx-form', {
+ className: 'confirm-screen-form',
onSubmit: this.onSubmit,
}, [
+ this.renderErrorMessage('simulationFails'),
h('.page-container__footer', [
// Cancel Button
h('button.btn-cancel.page-container__footer-button.allcaps', {