diff options
author | Alexander Tseung <alextsg@gmail.com> | 2018-07-07 02:58:41 +0800 |
---|---|---|
committer | Alexander Tseung <alextsg@gmail.com> | 2018-07-07 07:27:08 +0800 |
commit | a2d9c43fba49680d7553409a4f5013d3febd80e9 (patch) | |
tree | 56417ef3c675774173da49d3edfb951a3310fd5e /ui/app/components/confirm-page-container | |
parent | 9cde5ab11b0670eed7baeb2f31486cb3e253bdcb (diff) | |
download | tangerine-wallet-browser-a2d9c43fba49680d7553409a4f5013d3febd80e9.tar tangerine-wallet-browser-a2d9c43fba49680d7553409a4f5013d3febd80e9.tar.gz tangerine-wallet-browser-a2d9c43fba49680d7553409a4f5013d3febd80e9.tar.bz2 tangerine-wallet-browser-a2d9c43fba49680d7553409a4f5013d3febd80e9.tar.lz tangerine-wallet-browser-a2d9c43fba49680d7553409a4f5013d3febd80e9.tar.xz tangerine-wallet-browser-a2d9c43fba49680d7553409a4f5013d3febd80e9.tar.zst tangerine-wallet-browser-a2d9c43fba49680d7553409a4f5013d3febd80e9.zip |
Various fixes from PR comments
Diffstat (limited to 'ui/app/components/confirm-page-container')
3 files changed, 42 insertions, 27 deletions
diff --git a/ui/app/components/confirm-page-container/confirm-page-container-content/confirm-page-container-content.component.js b/ui/app/components/confirm-page-container/confirm-page-container-content/confirm-page-container-content.component.js index 7c7550170..08923af88 100644 --- a/ui/app/components/confirm-page-container/confirm-page-container-content/confirm-page-container-content.component.js +++ b/ui/app/components/confirm-page-container/confirm-page-container-content/confirm-page-container-content.component.js @@ -11,16 +11,17 @@ import { export default class ConfirmPageContainerContent extends Component { static propTypes = { action: PropTypes.string, - title: PropTypes.oneOfType([PropTypes.string, PropTypes.number]), - titleComponent: PropTypes.func, - subtitle: PropTypes.oneOfType([PropTypes.string, PropTypes.number]), - hideSubtitle: PropTypes.bool, - errorMessage: PropTypes.string, - summaryComponent: PropTypes.node, - detailsComponent: PropTypes.node, dataComponent: PropTypes.node, + detailsComponent: PropTypes.node, + errorKey: PropTypes.string, + errorMessage: PropTypes.string, + hideSubtitle: PropTypes.bool, identiconAddress: PropTypes.string, nonce: PropTypes.string, + subtitle: PropTypes.oneOfType([PropTypes.string, PropTypes.number]), + summaryComponent: PropTypes.node, + title: PropTypes.oneOfType([PropTypes.string, PropTypes.number]), + titleComponent: PropTypes.func, warning: PropTypes.string, } @@ -52,10 +53,11 @@ export default class ConfirmPageContainerContent extends Component { render () { const { action, + errorKey, + errorMessage, title, subtitle, hideSubtitle, - errorMessage, identiconAddress, nonce, summaryComponent, @@ -88,9 +90,12 @@ export default class ConfirmPageContainerContent extends Component { } { this.renderContent() } { - errorMessage && ( + (errorKey || errorMessage) && ( <div className="confirm-page-container-content__error-container"> - <ConfirmPageContainerError error={errorMessage} /> + <ConfirmPageContainerError + errorMessage={errorMessage} + errorKey={errorKey} + /> </div> ) } diff --git a/ui/app/components/confirm-page-container/confirm-page-container-content/confirm-page-container-error/confirm-page-container-error.component.js b/ui/app/components/confirm-page-container/confirm-page-container-content/confirm-page-container-error/confirm-page-container-error.component.js index dc5b9b935..70ebdeb20 100644 --- a/ui/app/components/confirm-page-container/confirm-page-container-content/confirm-page-container-error/confirm-page-container-error.component.js +++ b/ui/app/components/confirm-page-container/confirm-page-container-content/confirm-page-container-error/confirm-page-container-error.component.js @@ -1,20 +1,28 @@ import React from 'react' import PropTypes from 'prop-types' -const ConfirmPageContainerError = props => { +const ConfirmPageContainerError = (props, context) => { + const { errorMessage, errorKey } = props + const error = errorKey ? context.t(errorKey) : errorMessage + return ( <div className="confirm-page-container-error"> <img src="/images/alert-red.svg" className="confirm-page-container-error__icon" /> - { `ALERT: ${props.error}` } + { `ALERT: ${error}` } </div> ) } ConfirmPageContainerError.propTypes = { - error: PropTypes.string, + errorMessage: PropTypes.string, + errorKey: PropTypes.string, +} + +ConfirmPageContainerError.contextTypes = { + t: PropTypes.func, } export default ConfirmPageContainerError diff --git a/ui/app/components/confirm-page-container/confirm-page-container.component.js b/ui/app/components/confirm-page-container/confirm-page-container.component.js index d5247f83b..93e4ae7bf 100644 --- a/ui/app/components/confirm-page-container/confirm-page-container.component.js +++ b/ui/app/components/confirm-page-container/confirm-page-container.component.js @@ -10,25 +10,23 @@ export default class ConfirmPageContainer extends Component { } static propTypes = { - showEdit: PropTypes.bool, - onEdit: PropTypes.func, - // Sender to Recipient - fromName: PropTypes.string, - fromAddress: PropTypes.string, - toName: PropTypes.string, - toAddress: PropTypes.string, - - valid: PropTypes.bool, - errorMessage: PropTypes.string, // Header action: PropTypes.string, + hideSubtitle: PropTypes.bool, + onEdit: PropTypes.func, + showEdit: PropTypes.bool, + subtitle: PropTypes.string, title: PropTypes.string, titleComponent: PropTypes.func, - subtitle: PropTypes.string, - hideSubtitle: PropTypes.bool, + // Sender to Recipient + fromAddress: PropTypes.string, + fromName: PropTypes.string, + toAddress: PropTypes.string, + toName: PropTypes.string, // Content - summaryComponent: PropTypes.node, contentComponent: PropTypes.node, + errorKey: PropTypes.string, + errorMessage: PropTypes.string, fiatTransactionAmount: PropTypes.string, fiatTransactionFee: PropTypes.string, fiatTransactionTotal: PropTypes.string, @@ -36,14 +34,16 @@ export default class ConfirmPageContainer extends Component { ethTransactionFee: PropTypes.string, ethTransactionTotal: PropTypes.string, onEditGas: PropTypes.func, - detailsComponent: PropTypes.node, dataComponent: PropTypes.node, + detailsComponent: PropTypes.node, identiconAddress: PropTypes.string, nonce: PropTypes.string, + summaryComponent: PropTypes.node, warning: PropTypes.string, // Footer onCancel: PropTypes.func, onSubmit: PropTypes.func, + valid: PropTypes.bool, } render () { @@ -55,6 +55,7 @@ export default class ConfirmPageContainer extends Component { toName, toAddress, valid, + errorKey, errorMessage, contentComponent, action, @@ -97,6 +98,7 @@ export default class ConfirmPageContainer extends Component { detailsComponent={detailsComponent} dataComponent={dataComponent} errorMessage={errorMessage} + errorKey={errorKey} identiconAddress={identiconAddress} nonce={nonce} warning={warning} |