mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Merge branch 'master' of github.com:MetaMask/metamask-extension into ci-screens
This commit is contained in:
commit
15ba31897c
@ -42,6 +42,7 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
"rules": {
|
"rules": {
|
||||||
|
"no-restricted-globals": ["error", "event"],
|
||||||
"accessor-pairs": 2,
|
"accessor-pairs": 2,
|
||||||
"arrow-spacing": [2, { "before": true, "after": true }],
|
"arrow-spacing": [2, { "before": true, "after": true }],
|
||||||
"block-spacing": [2, "always"],
|
"block-spacing": [2, "always"],
|
||||||
|
@ -826,6 +826,9 @@
|
|||||||
"transactions": {
|
"transactions": {
|
||||||
"message": "transactions"
|
"message": "transactions"
|
||||||
},
|
},
|
||||||
|
"transactionError": {
|
||||||
|
"message": "Transaction Error. Exception thrown in contract code."
|
||||||
|
},
|
||||||
"transactionMemo": {
|
"transactionMemo": {
|
||||||
"message": "Transaction memo (optional)"
|
"message": "Transaction memo (optional)"
|
||||||
},
|
},
|
||||||
|
@ -207,7 +207,7 @@ gulp.task('dev:copy',
|
|||||||
|
|
||||||
// lint js
|
// lint js
|
||||||
|
|
||||||
const lintTargets = ['app/**/*.json', 'app/**/*.js', '!app/scripts/vendor/**/*.js', 'ui/**/*.js', 'mascara/src/*.js', 'mascara/server/*.js', '!node_modules/**', '!dist/firefox/**', '!docs/**', '!app/scripts/chromereload.js', '!mascara/test/jquery-3.1.0.min.js']
|
const lintTargets = ['app/**/*.json', 'app/**/*.js', '!app/scripts/vendor/**/*.js', 'ui/**/*.js', 'old-ui/**/*.js', 'mascara/src/*.js', 'mascara/server/*.js', '!node_modules/**', '!dist/firefox/**', '!docs/**', '!app/scripts/chromereload.js', '!mascara/test/jquery-3.1.0.min.js']
|
||||||
|
|
||||||
gulp.task('lint', function () {
|
gulp.task('lint', function () {
|
||||||
// Ignoring node_modules, dist/firefox, and docs folders:
|
// Ignoring node_modules, dist/firefox, and docs folders:
|
||||||
|
@ -581,7 +581,6 @@ App.prototype.renderPrimary = function () {
|
|||||||
|
|
||||||
case 'qr':
|
case 'qr':
|
||||||
log.debug('rendering show qr screen')
|
log.debug('rendering show qr screen')
|
||||||
console.log(`QrView`, QrView);
|
|
||||||
return h('div', {
|
return h('div', {
|
||||||
style: {
|
style: {
|
||||||
position: 'absolute',
|
position: 'absolute',
|
||||||
|
@ -247,7 +247,6 @@ BuyButtonSubview.prototype.backButtonContext = function () {
|
|||||||
if (this.props.context === 'confTx') {
|
if (this.props.context === 'confTx') {
|
||||||
this.props.dispatch(actions.showConfTxPage(false))
|
this.props.dispatch(actions.showConfTxPage(false))
|
||||||
} else {
|
} else {
|
||||||
console.log(`actions.goHome`, actions.goHome);
|
|
||||||
this.props.dispatch(actions.goHome())
|
this.props.dispatch(actions.goHome())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,6 @@ function QrCodeView () {
|
|||||||
QrCodeView.prototype.render = function () {
|
QrCodeView.prototype.render = function () {
|
||||||
const props = this.props
|
const props = this.props
|
||||||
const Qr = props.Qr
|
const Qr = props.Qr
|
||||||
console.log(`QrCodeView Qr`, Qr);
|
|
||||||
const address = `${isHexPrefixed(Qr.data) ? 'ethereum:' : ''}${Qr.data}`
|
const address = `${isHexPrefixed(Qr.data) ? 'ethereum:' : ''}${Qr.data}`
|
||||||
const qrImage = qrCode(4, 'M')
|
const qrImage = qrCode(4, 'M')
|
||||||
qrImage.addData(address)
|
qrImage.addData(address)
|
||||||
|
@ -35,7 +35,7 @@ RangeSlider.prototype.render = function () {
|
|||||||
step: increment,
|
step: increment,
|
||||||
style: range,
|
style: range,
|
||||||
value: state.value || defaultValue,
|
value: state.value || defaultValue,
|
||||||
onChange: mirrorInput ? this.mirrorInputs.bind(this, event) : onInput,
|
onChange: mirrorInput ? this.mirrorInputs.bind(this) : onInput,
|
||||||
}),
|
}),
|
||||||
|
|
||||||
// Mirrored input for range
|
// Mirrored input for range
|
||||||
@ -47,7 +47,7 @@ RangeSlider.prototype.render = function () {
|
|||||||
value: state.value || defaultValue,
|
value: state.value || defaultValue,
|
||||||
step: increment,
|
step: increment,
|
||||||
style: input,
|
style: input,
|
||||||
onChange: this.mirrorInputs.bind(this, event),
|
onChange: this.mirrorInputs.bind(this),
|
||||||
}) : null,
|
}) : null,
|
||||||
])
|
])
|
||||||
)
|
)
|
||||||
|
@ -30,7 +30,7 @@ function TransactionListItem () {
|
|||||||
|
|
||||||
TransactionListItem.prototype.showRetryButton = function () {
|
TransactionListItem.prototype.showRetryButton = function () {
|
||||||
const { transaction = {}, transactions } = this.props
|
const { transaction = {}, transactions } = this.props
|
||||||
const { status, submittedTime, txParams } = transaction
|
const { submittedTime, txParams } = transaction
|
||||||
|
|
||||||
if (!txParams) {
|
if (!txParams) {
|
||||||
return false
|
return false
|
||||||
|
@ -42,7 +42,7 @@ ConfigScreen.prototype.render = function () {
|
|||||||
// subtitle and nav
|
// subtitle and nav
|
||||||
h('.section-title.flex-row.flex-center', [
|
h('.section-title.flex-row.flex-center', [
|
||||||
h('i.fa.fa-arrow-left.fa-lg.cursor-pointer', {
|
h('i.fa.fa-arrow-left.fa-lg.cursor-pointer', {
|
||||||
onClick: (event) => {
|
onClick: () => {
|
||||||
state.dispatch(actions.goHome())
|
state.dispatch(actions.goHome())
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
|
@ -109,16 +109,50 @@ function ConfirmSendEther () {
|
|||||||
this.onSubmit = this.onSubmit.bind(this)
|
this.onSubmit = this.onSubmit.bind(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
ConfirmSendEther.prototype.componentWillMount = function () {
|
ConfirmSendEther.prototype.updateComponentSendErrors = function (prevProps) {
|
||||||
const { updateSendErrors } = this.props
|
const {
|
||||||
|
balance: oldBalance,
|
||||||
|
conversionRate: oldConversionRate,
|
||||||
|
} = prevProps
|
||||||
|
const {
|
||||||
|
updateSendErrors,
|
||||||
|
balance,
|
||||||
|
conversionRate,
|
||||||
|
send: {
|
||||||
|
errors: {
|
||||||
|
simulationFails,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
} = this.props
|
||||||
const txMeta = this.gatherTxMeta()
|
const txMeta = this.gatherTxMeta()
|
||||||
const balanceIsSufficient = this.isBalanceSufficient(txMeta)
|
|
||||||
|
|
||||||
updateSendErrors({
|
const shouldUpdateBalanceSendErrors = balance && [
|
||||||
insufficientFunds: balanceIsSufficient
|
balance !== oldBalance,
|
||||||
? false
|
conversionRate !== oldConversionRate,
|
||||||
: this.context.t('insufficientFunds'),
|
].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 () {
|
ConfirmSendEther.prototype.getAmount = function () {
|
||||||
@ -457,8 +491,10 @@ ConfirmSendEther.prototype.render = function () {
|
|||||||
]),
|
]),
|
||||||
|
|
||||||
h('form#pending-tx-form', {
|
h('form#pending-tx-form', {
|
||||||
|
className: 'confirm-screen-form',
|
||||||
onSubmit: this.onSubmit,
|
onSubmit: this.onSubmit,
|
||||||
}, [
|
}, [
|
||||||
|
this.renderErrorMessage('simulationFails'),
|
||||||
h('.page-container__footer', [
|
h('.page-container__footer', [
|
||||||
// Cancel Button
|
// Cancel Button
|
||||||
h('button.btn-cancel.page-container__footer-button.allcaps', {
|
h('button.btn-cancel.page-container__footer-button.allcaps', {
|
||||||
|
@ -147,21 +147,56 @@ function ConfirmSendToken () {
|
|||||||
this.onSubmit = this.onSubmit.bind(this)
|
this.onSubmit = this.onSubmit.bind(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
ConfirmSendToken.prototype.componentWillMount = function () {
|
ConfirmSendToken.prototype.updateComponentSendErrors = function (prevProps) {
|
||||||
const { tokenContract, selectedAddress, updateSendErrors} = this.props
|
const {
|
||||||
|
balance: oldBalance,
|
||||||
|
conversionRate: oldConversionRate,
|
||||||
|
} = prevProps
|
||||||
|
const {
|
||||||
|
updateSendErrors,
|
||||||
|
balance,
|
||||||
|
conversionRate,
|
||||||
|
send: {
|
||||||
|
errors: {
|
||||||
|
simulationFails,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
} = this.props
|
||||||
const txMeta = this.gatherTxMeta()
|
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
|
tokenContract && tokenContract
|
||||||
.balanceOf(selectedAddress)
|
.balanceOf(selectedAddress)
|
||||||
.then(usersToken => {
|
.then(usersToken => {
|
||||||
})
|
})
|
||||||
this.props.updateTokenExchangeRate()
|
this.props.updateTokenExchangeRate()
|
||||||
|
this.updateComponentSendErrors({})
|
||||||
|
}
|
||||||
|
|
||||||
updateSendErrors({
|
ConfirmSendToken.prototype.componentDidUpdate = function (prevProps) {
|
||||||
insufficientFunds: balanceIsSufficient
|
this.updateComponentSendErrors(prevProps)
|
||||||
? false
|
|
||||||
: this.context.t('insufficientFunds'),
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ConfirmSendToken.prototype.getAmount = function () {
|
ConfirmSendToken.prototype.getAmount = function () {
|
||||||
@ -467,8 +502,10 @@ ConfirmSendToken.prototype.render = function () {
|
|||||||
]),
|
]),
|
||||||
|
|
||||||
h('form#pending-tx-form', {
|
h('form#pending-tx-form', {
|
||||||
|
className: 'confirm-screen-form',
|
||||||
onSubmit: this.onSubmit,
|
onSubmit: this.onSubmit,
|
||||||
}, [
|
}, [
|
||||||
|
this.renderErrorMessage('simulationFails'),
|
||||||
h('.page-container__footer', [
|
h('.page-container__footer', [
|
||||||
// Cancel Button
|
// Cancel Button
|
||||||
h('button.btn-cancel.page-container__footer-button.allcaps', {
|
h('button.btn-cancel.page-container__footer-button.allcaps', {
|
||||||
|
@ -312,6 +312,17 @@ section .confirm-screen-account-number,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.confirm-screen-form {
|
||||||
|
position: relative;
|
||||||
|
|
||||||
|
.confirm-screen-error {
|
||||||
|
right: 0;
|
||||||
|
width: 100%;
|
||||||
|
margin-top: 7px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.confirm-screen-confirm-button {
|
.confirm-screen-confirm-button {
|
||||||
height: 50px;
|
height: 50px;
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
|
Loading…
Reference in New Issue
Block a user