diff options
author | Whymarrh Whitby <whymarrh.whitby@gmail.com> | 2019-08-01 04:17:11 +0800 |
---|---|---|
committer | Frankie <frankie.diamond@gmail.com> | 2019-08-01 04:17:11 +0800 |
commit | 4d88e1cf862c3ae174780cd888d7703685db23e7 (patch) | |
tree | 93f7cd0e7bbcb42c7be310f0e6b12230eace9492 /ui/app/components | |
parent | e9c7df28ed88f6dc3a5074cf873f3920429d1803 (diff) | |
download | tangerine-wallet-browser-4d88e1cf862c3ae174780cd888d7703685db23e7.tar.gz tangerine-wallet-browser-4d88e1cf862c3ae174780cd888d7703685db23e7.tar.zst tangerine-wallet-browser-4d88e1cf862c3ae174780cd888d7703685db23e7.zip |
Enable indent linting via ESLint (#6936)
* Enable indent linting via ESLint
* yarn run lint:fix
Diffstat (limited to 'ui/app/components')
30 files changed, 325 insertions, 325 deletions
diff --git a/ui/app/components/app/confirm-page-container/confirm-detail-row/tests/confirm-detail-row.component.test.js b/ui/app/components/app/confirm-page-container/confirm-detail-row/tests/confirm-detail-row.component.test.js index c8507985d..95ca8144a 100644 --- a/ui/app/components/app/confirm-page-container/confirm-detail-row/tests/confirm-detail-row.component.test.js +++ b/ui/app/components/app/confirm-page-container/confirm-detail-row/tests/confirm-detail-row.component.test.js @@ -27,7 +27,7 @@ describe('Confirm Detail Row Component', function () { ) }) - describe('render', () => { + describe('render', () => { it('should render a div with a confirm-detail-row class', () => { assert.equal(wrapper.find('div.confirm-detail-row').length, 1) }) @@ -60,5 +60,5 @@ describe('Confirm Detail Row Component', function () { wrapper.find('.confirm-detail-row__header-text').props().onClick() assert.equal(assert.equal(propsMethodSpies.onHeaderClick.callCount, 1)) }) - }) + }) }) diff --git a/ui/app/components/app/confirm-page-container/confirm-page-container-navigation/confirm-page-container-navigation.component.js b/ui/app/components/app/confirm-page-container/confirm-page-container-navigation/confirm-page-container-navigation.component.js index 8327f997b..c24d24b17 100755 --- a/ui/app/components/app/confirm-page-container/confirm-page-container-navigation/confirm-page-container-navigation.component.js +++ b/ui/app/components/app/confirm-page-container/confirm-page-container-navigation/confirm-page-container-navigation.component.js @@ -6,9 +6,9 @@ const ConfirmPageContainerNavigation = props => { return ( <div className="confirm-page-container-navigation" - style={{ - display: showNavigation ? 'flex' : 'none', - }} + style={{ + display: showNavigation ? 'flex' : 'none', + }} > <div className="confirm-page-container-navigation__container" style={{ diff --git a/ui/app/components/app/confirm-page-container/confirm-page-container.component.js b/ui/app/components/app/confirm-page-container/confirm-page-container.component.js index 326e4f83e..1ff797fa1 100644 --- a/ui/app/components/app/confirm-page-container/confirm-page-container.component.js +++ b/ui/app/components/app/confirm-page-container/confirm-page-container.component.js @@ -106,16 +106,16 @@ export default class ConfirmPageContainer extends Component { return ( <div className="page-container"> <ConfirmPageContainerNavigation - totalTx={totalTx} - positionOfCurrentTx={positionOfCurrentTx} - nextTxId={nextTxId} - prevTxId={prevTxId} - showNavigation={showNavigation} - onNextTx={(txId) => onNextTx(txId)} - firstTx={firstTx} - lastTx={lastTx} - ofText={ofText} - requestsWaitingText={requestsWaitingText} + totalTx={totalTx} + positionOfCurrentTx={positionOfCurrentTx} + nextTxId={nextTxId} + prevTxId={prevTxId} + showNavigation={showNavigation} + onNextTx={(txId) => onNextTx(txId)} + firstTx={firstTx} + lastTx={lastTx} + ofText={ofText} + requestsWaitingText={requestsWaitingText} /> <ConfirmPageContainerHeader showEdit={showEdit} diff --git a/ui/app/components/app/dropdowns/account-details-dropdown.js b/ui/app/components/app/dropdowns/account-details-dropdown.js index a4c33620a..cf2aa8ae8 100644 --- a/ui/app/components/app/dropdowns/account-details-dropdown.js +++ b/ui/app/components/app/dropdowns/account-details-dropdown.js @@ -59,7 +59,7 @@ AccountDetailsDropdown.prototype.render = function () { viewOnEtherscan, showRemoveAccountConfirmationModal, rpcPrefs, - } = this.props + } = this.props const address = selectedIdentity.address diff --git a/ui/app/components/app/dropdowns/network-dropdown.js b/ui/app/components/app/dropdowns/network-dropdown.js index 7a656d5b9..e6a24ef11 100644 --- a/ui/app/components/app/dropdowns/network-dropdown.js +++ b/ui/app/components/app/dropdowns/network-dropdown.js @@ -353,12 +353,12 @@ NetworkDropdown.prototype.renderCommonRpc = function (rpcListDetail, provider) { }, }, nickname || rpc), h('i.fa.fa-times.delete', - { - onClick: (e) => { - e.stopPropagation() - props.delRpcTarget(rpc) - }, - }), + { + onClick: (e) => { + e.stopPropagation() + props.delRpcTarget(rpc) + }, + }), ] ) } diff --git a/ui/app/components/app/gas-customization/advanced-gas-inputs/advanced-gas-inputs.component.js b/ui/app/components/app/gas-customization/advanced-gas-inputs/advanced-gas-inputs.component.js index d942fd150..7b87b3033 100644 --- a/ui/app/components/app/gas-customization/advanced-gas-inputs/advanced-gas-inputs.component.js +++ b/ui/app/components/app/gas-customization/advanced-gas-inputs/advanced-gas-inputs.component.js @@ -131,8 +131,8 @@ export default class AdvancedTabContent extends Component { </div> { isInError ? <div className={`advanced-gas-inputs__gas-edit-row__${errorType}-text`}> - { errorText } - </div> + { errorText } + </div> : null } </div> ) diff --git a/ui/app/components/app/gas-customization/gas-modal-page-container/advanced-tab-content/advanced-tab-content.component.js b/ui/app/components/app/gas-customization/gas-modal-page-container/advanced-tab-content/advanced-tab-content.component.js index 3924d26ad..88d28b9ed 100644 --- a/ui/app/components/app/gas-customization/gas-modal-page-container/advanced-tab-content/advanced-tab-content.component.js +++ b/ui/app/components/app/gas-customization/gas-modal-page-container/advanced-tab-content/advanced-tab-content.component.js @@ -104,8 +104,8 @@ export default class AdvancedTabContent extends Component { </div> { isInError ? <div className={`advanced-tab__gas-edit-row__${errorType}-text`}> - { errorText } - </div> + { errorText } + </div> : null } </div> ) diff --git a/ui/app/components/app/gas-customization/gas-modal-page-container/basic-tab-content/basic-tab-content.component.js b/ui/app/components/app/gas-customization/gas-modal-page-container/basic-tab-content/basic-tab-content.component.js index 5f3925fa5..931611460 100644 --- a/ui/app/components/app/gas-customization/gas-modal-page-container/basic-tab-content/basic-tab-content.component.js +++ b/ui/app/components/app/gas-customization/gas-modal-page-container/basic-tab-content/basic-tab-content.component.js @@ -21,12 +21,12 @@ export default class BasicTabContent extends Component { <div className="basic-tab-content__title">{ t('estimatedProcessingTimes') }</div> <div className="basic-tab-content__blurb">{ t('selectAHigherGasFee') }</div> {!gasPriceButtonGroupProps.loading - ? <GasPriceButtonGroup - className="gas-price-button-group--alt" - showCheck={true} - {...gasPriceButtonGroupProps} - /> - : <Loading /> + ? <GasPriceButtonGroup + className="gas-price-button-group--alt" + showCheck={true} + {...gasPriceButtonGroupProps} + /> + : <Loading /> } <div className="basic-tab-content__footer-blurb">{ t('acceleratingATransaction') }</div> </div> diff --git a/ui/app/components/app/gas-customization/gas-modal-page-container/gas-modal-page-container.component.js b/ui/app/components/app/gas-customization/gas-modal-page-container/gas-modal-page-container.component.js index e18c1067e..5e557f660 100644 --- a/ui/app/components/app/gas-customization/gas-modal-page-container/gas-modal-page-container.component.js +++ b/ui/app/components/app/gas-customization/gas-modal-page-container/gas-modal-page-container.component.js @@ -47,7 +47,7 @@ export default class GasModalPageContainer extends Component { const promise = this.props.hideBasic ? Promise.resolve(this.props.blockTime) : this.props.fetchBasicGasAndTimeEstimates() - .then(basicEstimates => basicEstimates.blockTime) + .then(basicEstimates => basicEstimates.blockTime) promise .then(blockTime => { @@ -144,11 +144,11 @@ export default class GasModalPageContainer extends Component { return ( <Tabs> {tabsToRender.map(({ name, content }, i) => <Tab name={this.context.t(name)} key={`gas-modal-tab-${i}`}> - <div className="gas-modal-content"> - { content } - { this.renderInfoRows(newTotalFiat, newTotalEth, sendAmount, transactionFee) } - </div> - </Tab> + <div className="gas-modal-content"> + { content } + { this.renderInfoRows(newTotalFiat, newTotalEth, sendAmount, transactionFee) } + </div> + </Tab> )} </Tabs> ) diff --git a/ui/app/components/app/gas-customization/gas-modal-page-container/tests/gas-modal-page-container-container.test.js b/ui/app/components/app/gas-customization/gas-modal-page-container/tests/gas-modal-page-container-container.test.js index 03d254eee..d5f3837a9 100644 --- a/ui/app/components/app/gas-customization/gas-modal-page-container/tests/gas-modal-page-container-container.test.js +++ b/ui/app/components/app/gas-customization/gas-modal-page-container/tests/gas-modal-page-container-container.test.js @@ -341,44 +341,44 @@ describe('gas-modal-page-container container', () => { }) describe('mergeProps', () => { - let stateProps - let dispatchProps - let ownProps - - beforeEach(() => { - stateProps = { - gasPriceButtonGroupProps: { - someGasPriceButtonGroupProp: 'foo', - anotherGasPriceButtonGroupProp: 'bar', - }, - isConfirm: true, - someOtherStateProp: 'baz', - transaction: {}, - } - dispatchProps = { - updateCustomGasPrice: sinon.spy(), - hideGasButtonGroup: sinon.spy(), - setGasData: sinon.spy(), - updateConfirmTxGasAndCalculate: sinon.spy(), - someOtherDispatchProp: sinon.spy(), - createSpeedUpTransaction: sinon.spy(), - hideSidebar: sinon.spy(), - hideModal: sinon.spy(), - cancelAndClose: sinon.spy(), - } - ownProps = { someOwnProp: 123 } - }) + let stateProps + let dispatchProps + let ownProps - afterEach(() => { - dispatchProps.updateCustomGasPrice.resetHistory() - dispatchProps.hideGasButtonGroup.resetHistory() - dispatchProps.setGasData.resetHistory() - dispatchProps.updateConfirmTxGasAndCalculate.resetHistory() - dispatchProps.someOtherDispatchProp.resetHistory() - dispatchProps.createSpeedUpTransaction.resetHistory() - dispatchProps.hideSidebar.resetHistory() - dispatchProps.hideModal.resetHistory() - }) + beforeEach(() => { + stateProps = { + gasPriceButtonGroupProps: { + someGasPriceButtonGroupProp: 'foo', + anotherGasPriceButtonGroupProp: 'bar', + }, + isConfirm: true, + someOtherStateProp: 'baz', + transaction: {}, + } + dispatchProps = { + updateCustomGasPrice: sinon.spy(), + hideGasButtonGroup: sinon.spy(), + setGasData: sinon.spy(), + updateConfirmTxGasAndCalculate: sinon.spy(), + someOtherDispatchProp: sinon.spy(), + createSpeedUpTransaction: sinon.spy(), + hideSidebar: sinon.spy(), + hideModal: sinon.spy(), + cancelAndClose: sinon.spy(), + } + ownProps = { someOwnProp: 123 } + }) + + afterEach(() => { + dispatchProps.updateCustomGasPrice.resetHistory() + dispatchProps.hideGasButtonGroup.resetHistory() + dispatchProps.setGasData.resetHistory() + dispatchProps.updateConfirmTxGasAndCalculate.resetHistory() + dispatchProps.someOtherDispatchProp.resetHistory() + dispatchProps.createSpeedUpTransaction.resetHistory() + dispatchProps.hideSidebar.resetHistory() + dispatchProps.hideModal.resetHistory() + }) it('should return the expected props when isConfirm is true', () => { const result = mergeProps(stateProps, dispatchProps, ownProps) diff --git a/ui/app/components/app/gas-customization/gas-price-chart/gas-price-chart.utils.js b/ui/app/components/app/gas-customization/gas-price-chart/gas-price-chart.utils.js index 55512ce09..b941f1cf9 100644 --- a/ui/app/components/app/gas-customization/gas-price-chart/gas-price-chart.utils.js +++ b/ui/app/components/app/gas-customization/gas-price-chart/gas-price-chart.utils.js @@ -210,17 +210,17 @@ export function generateChart (gasPrices, estimatedTimes, gasPricesMax, estimate }, padding: {left: 20, right: 15, top: 6, bottom: 10}, data: { - x: 'x', - columns: [ - ['x', ...gasPrices], - ['data1', ...estimatedTimes], - ], - types: { - data1: 'area', - }, - selection: { - enabled: false, - }, + x: 'x', + columns: [ + ['x', ...gasPrices], + ['data1', ...estimatedTimes], + ], + types: { + data1: 'area', + }, + selection: { + enabled: false, + }, }, color: { data1: '#259de5', @@ -254,13 +254,13 @@ export function generateChart (gasPrices, estimatedTimes, gasPricesMax, estimate }, }, legend: { - show: false, + show: false, }, grid: { - x: {}, - lines: { - front: false, - }, + x: {}, + lines: { + front: false, + }, }, point: { focus: { @@ -296,8 +296,8 @@ export function generateChart (gasPrices, estimatedTimes, gasPricesMax, estimate const flipTooltip = circleY - circleWidth < chartYStart + 5 d3 - .select('.tooltip-arrow') - .style('margin-top', flipTooltip ? '-16px' : '4px') + .select('.tooltip-arrow') + .style('margin-top', flipTooltip ? '-16px' : '4px') return { top: bigNumMinus(circleY, chartYStart).minus(19).plus(flipTooltip ? circleWidth + 38 : 0).toNumber(), diff --git a/ui/app/components/app/modals/account-details-modal/account-details-modal.component.js b/ui/app/components/app/modals/account-details-modal/account-details-modal.component.js index e3919edcf..1b9a6a718 100644 --- a/ui/app/components/app/modals/account-details-modal/account-details-modal.component.js +++ b/ui/app/components/app/modals/account-details-modal/account-details-modal.component.js @@ -72,14 +72,14 @@ export default class AccountDetailsModal extends Component { </Button> {exportPrivateKeyFeatureEnabled - ? <Button - type="secondary" - className="account-modal__button" - onClick={() => showExportPrivateKeyModal()} - > - {this.context.t('exportPrivateKey')} - </Button> - : null + ? <Button + type="secondary" + className="account-modal__button" + onClick={() => showExportPrivateKeyModal()} + > + {this.context.t('exportPrivateKey')} + </Button> + : null } </AccountModalContainer> ) diff --git a/ui/app/components/app/modals/deposit-ether-modal.js b/ui/app/components/app/modals/deposit-ether-modal.js index 20c4d018c..ff2411209 100644 --- a/ui/app/components/app/modals/deposit-ether-modal.js +++ b/ui/app/components/app/modals/deposit-ether-modal.js @@ -87,8 +87,8 @@ DepositEtherModal.prototype.renderRow = function ({ } return h('div', { - className: className || 'deposit-ether-modal__buy-row', - }, [ + className: className || 'deposit-ether-modal__buy-row', + }, [ onBackClick && showBackButton && h('div.deposit-ether-modal__buy-row__back', { onClick: onBackClick, @@ -100,22 +100,22 @@ DepositEtherModal.prototype.renderRow = function ({ h('div.deposit-ether-modal__buy-row__logo-container', [logo]), - h('div.deposit-ether-modal__buy-row__description', [ + h('div.deposit-ether-modal__buy-row__description', [ - !hideTitle && h('div.deposit-ether-modal__buy-row__description__title', [title]), + !hideTitle && h('div.deposit-ether-modal__buy-row__description__title', [title]), - h('div.deposit-ether-modal__buy-row__description__text', [text]), + h('div.deposit-ether-modal__buy-row__description__text', [text]), - ]), + ]), - !hideButton && h('div.deposit-ether-modal__buy-row__button', [ - h(Button, { - type: 'secondary', - className: 'deposit-ether-modal__deposit-button', - large: true, - onClick: onButtonClick, - }, [buttonLabel]), - ]), + !hideButton && h('div.deposit-ether-modal__buy-row__button', [ + h(Button, { + type: 'secondary', + className: 'deposit-ether-modal__deposit-button', + large: true, + onClick: onButtonClick, + }, [buttonLabel]), + ]), ]) } diff --git a/ui/app/components/app/modals/export-private-key-modal.js b/ui/app/components/app/modals/export-private-key-modal.js index c3098a16c..43d7bcd74 100644 --- a/ui/app/components/app/modals/export-private-key-modal.js +++ b/ui/app/components/app/modals/export-private-key-modal.js @@ -86,12 +86,12 @@ ExportPrivateKeyModal.prototype.renderPasswordInput = function (privateKey) { return privateKey ? h(ReadOnlyInput, { - wrapperClass: 'private-key-password-display-wrapper', - inputClass: 'private-key-password-display-textarea', - textarea: true, - value: plainKey, - onClick: () => copyToClipboard(plainKey), - }) + wrapperClass: 'private-key-password-display-wrapper', + inputClass: 'private-key-password-display-textarea', + textarea: true, + value: plainKey, + onClick: () => copyToClipboard(plainKey), + }) : h('input.private-key-password-input', { type: 'password', onChange: event => this.setState({ password: event.target.value }), @@ -109,14 +109,14 @@ ExportPrivateKeyModal.prototype.renderButtons = function (privateKey, address, h (privateKey ? ( - h(Button, { + h(Button, { type: 'secondary', large: true, className: 'export-private-key__button', onClick: () => hideModal(), }, this.context.t('done')) ) : ( - h(Button, { + h(Button, { type: 'secondary', large: true, className: 'export-private-key__button', @@ -149,29 +149,29 @@ ExportPrivateKeyModal.prototype.render = function () { backButtonAction: () => showAccountDetailModal(), }, [ - h('span.account-name', name), + h('span.account-name', name), - h(ReadOnlyInput, { - wrapperClass: 'ellip-address-wrapper', - inputClass: 'qr-ellip-address ellip-address', - value: checksumAddress(address), - }), + h(ReadOnlyInput, { + wrapperClass: 'ellip-address-wrapper', + inputClass: 'qr-ellip-address ellip-address', + value: checksumAddress(address), + }), - h('div.account-modal-divider'), + h('div.account-modal-divider'), - h('span.modal-body-title', this.context.t('showPrivateKeys')), + h('span.modal-body-title', this.context.t('showPrivateKeys')), - h('div.private-key-password', {}, [ - this.renderPasswordLabel(privateKey), + h('div.private-key-password', {}, [ + this.renderPasswordLabel(privateKey), - this.renderPasswordInput(privateKey), + this.renderPasswordInput(privateKey), - showWarning && warning ? h('span.private-key-password-error', warning) : null, - ]), + showWarning && warning ? h('span.private-key-password-error', warning) : null, + ]), - h('div.private-key-password-warning', this.context.t('privateKeyWarning')), + h('div.private-key-password-warning', this.context.t('privateKeyWarning')), - this.renderButtons(privateKey, address, hideModal), + this.renderButtons(privateKey, address, hideModal), ]) } diff --git a/ui/app/components/app/modals/new-account-modal.js b/ui/app/components/app/modals/new-account-modal.js index 27c81a701..4b18c52ba 100644 --- a/ui/app/components/app/modals/new-account-modal.js +++ b/ui/app/components/app/modals/new-account-modal.js @@ -69,7 +69,7 @@ NewAccountModal.propTypes = { showImportPage: PropTypes.func, createAccount: PropTypes.func, numberOfExistingAccounts: PropTypes.number, - t: PropTypes.func, + t: PropTypes.func, } const mapStateToProps = state => { diff --git a/ui/app/components/app/modals/notification-modal.js b/ui/app/components/app/modals/notification-modal.js index b8503ec1a..84d9004b7 100644 --- a/ui/app/components/app/modals/notification-modal.js +++ b/ui/app/components/app/modals/notification-modal.js @@ -62,7 +62,7 @@ NotificationModal.propTypes = { showCancelButton: PropTypes.bool, showConfirmButton: PropTypes.bool, onConfirm: PropTypes.func, - t: PropTypes.func, + t: PropTypes.func, } const mapDispatchToProps = dispatch => { diff --git a/ui/app/components/app/modals/qr-scanner/qr-scanner.component.js b/ui/app/components/app/modals/qr-scanner/qr-scanner.component.js index cb8b07ff1..afeaef0da 100644 --- a/ui/app/components/app/modals/qr-scanner/qr-scanner.component.js +++ b/ui/app/components/app/modals/qr-scanner/qr-scanner.component.js @@ -75,23 +75,23 @@ export default class QrScanner extends Component { clearTimeout(this.permissionChecker) this.checkPermisisions() this.codeReader.decodeFromInputVideoDevice(undefined, 'video') - .then(content => { - const result = this.parseContent(content.text) - if (result.type !== 'unknown') { - this.props.qrCodeDetected(result) - this.stopAndClose() - } else { - this.setState({msg: this.context.t('unknownQrCode')}) - } - }) - .catch(err => { - if (err && err.name === 'NotAllowedError') { - this.setState({msg: this.context.t('youNeedToAllowCameraAccess')}) - clearTimeout(this.permissionChecker) - this.needsToReinit = true - this.checkPermisisions() - } - }) + .then(content => { + const result = this.parseContent(content.text) + if (result.type !== 'unknown') { + this.props.qrCodeDetected(result) + this.stopAndClose() + } else { + this.setState({msg: this.context.t('unknownQrCode')}) + } + }) + .catch(err => { + if (err && err.name === 'NotAllowedError') { + this.setState({msg: this.context.t('youNeedToAllowCameraAccess')}) + clearTimeout(this.permissionChecker) + this.needsToReinit = true + this.checkPermisisions() + } + }) }).catch(err => { console.error('[QR-SCANNER]: getVideoInputDevices threw an exception: ', err) }) diff --git a/ui/app/components/app/network-display/network-display.component.js b/ui/app/components/app/network-display/network-display.component.js index 9ef5341b0..266476267 100644 --- a/ui/app/components/app/network-display/network-display.component.js +++ b/ui/app/components/app/network-display/network-display.component.js @@ -39,12 +39,12 @@ export default class NetworkDisplay extends Component { return networkClass ? <div className={`network-display__icon network-display__icon--${networkClass}`} /> : <div - className="i fa fa-question-circle fa-med" - style={{ - margin: '0 4px', - color: 'rgb(125, 128, 130)', - }} - /> + className="i fa fa-question-circle fa-med" + style={{ + margin: '0 4px', + color: 'rgb(125, 128, 130)', + }} + /> } render () { @@ -62,12 +62,12 @@ export default class NetworkDisplay extends Component { networkClass ? <div className={`network-display__icon network-display__icon--${networkClass}`} /> : <div - className="i fa fa-question-circle fa-med" - style={{ - margin: '0 4px', - color: 'rgb(125, 128, 130)', - }} - /> + className="i fa fa-question-circle fa-med" + style={{ + margin: '0 4px', + color: 'rgb(125, 128, 130)', + }} + /> } <div className="network-display__name"> { type === 'rpc' && nickname ? nickname : this.context.t(type) } diff --git a/ui/app/components/app/network.js b/ui/app/components/app/network.js index e778700cd..d46906a66 100644 --- a/ui/app/components/app/network.js +++ b/ui/app/components/app/network.js @@ -127,19 +127,19 @@ Network.prototype.render = function () { default: return h('.network-indicator', [ networkNumber === 'loading' - ? h('span.pointer.network-loading-spinner', { - onClick: (event) => this.props.onClick(event), - }, [ - h('img', { - title: context.t('attemptingConnect'), - src: 'images/loading.svg', + ? h('span.pointer.network-loading-spinner', { + onClick: (event) => this.props.onClick(event), + }, [ + h('img', { + title: context.t('attemptingConnect'), + src: 'images/loading.svg', + }), + ]) + : h('i.fa.fa-question-circle.fa-lg', { + style: { + color: 'rgb(125, 128, 130)', + }, }), - ]) - : h('i.fa.fa-question-circle.fa-lg', { - style: { - color: 'rgb(125, 128, 130)', - }, - }), h('.network-name', providerName === 'localhost' ? context.t('localhost') : providerNick || context.t('privateNetwork')), h('.network-indicator__down-arrow'), diff --git a/ui/app/components/app/sidebars/sidebar.component.js b/ui/app/components/app/sidebars/sidebar.component.js index 657982a21..e532ba7e5 100644 --- a/ui/app/components/app/sidebars/sidebar.component.js +++ b/ui/app/components/app/sidebars/sidebar.component.js @@ -26,7 +26,7 @@ export default class Sidebar extends Component { onOverlayClose && onOverlayClose() this.props.hideSidebar() } - } /> + } /> } renderSidebarContent () { diff --git a/ui/app/components/app/signature-request.js b/ui/app/components/app/signature-request.js index 32823aa8e..9c0f53f57 100644 --- a/ui/app/components/app/signature-request.js +++ b/ui/app/components/app/signature-request.js @@ -251,7 +251,7 @@ SignatureRequest.prototype.renderBody = function () { url: 'https://metamask.zendesk.com/hc/en-us/articles/360015488751', }) }, - }, this.context.t('learnMore'))] + }, this.context.t('learnMore'))] } return h('div.request-signature__body', {}, [ diff --git a/ui/app/components/app/token-list.js b/ui/app/components/app/token-list.js index 2188e7020..000ca6b3f 100644 --- a/ui/app/components/app/token-list.js +++ b/ui/app/components/app/token-list.js @@ -67,8 +67,8 @@ TokenList.prototype.render = function () { }, onClick: () => { global.platform.openWindow({ - url: `https://ethplorer.io/address/${userAddress}`, - }) + url: `https://ethplorer.io/address/${userAddress}`, + }) }, }, this.context.t('here')), ]) @@ -125,13 +125,13 @@ TokenList.prototype.createFreshTokenTracker = function () { this.tracker.on('error', this.showError) this.tracker.updateBalances() - .then(() => { - this.updateBalances(this.tracker.serialize()) - }) - .catch((reason) => { - log.error(`Problem updating balances`, reason) - this.setState({ isLoading: false }) - }) + .then(() => { + this.updateBalances(this.tracker.serialize()) + }) + .catch((reason) => { + log.error(`Problem updating balances`, reason) + this.setState({ isLoading: false }) + }) } TokenList.prototype.componentDidUpdate = function (prevProps) { diff --git a/ui/app/components/app/transaction-activity-log/transaction-activity-log-icon/transaction-activity-log-icon.component.js b/ui/app/components/app/transaction-activity-log/transaction-activity-log-icon/transaction-activity-log-icon.component.js index 871716002..6124325be 100644 --- a/ui/app/components/app/transaction-activity-log/transaction-activity-log-icon/transaction-activity-log-icon.component.js +++ b/ui/app/components/app/transaction-activity-log/transaction-activity-log-icon/transaction-activity-log-icon.component.js @@ -40,15 +40,15 @@ export default class TransactionActivityLogIcon extends PureComponent { return ( <div className={classnames('transaction-activity-log-icon', className)}> - { - imagePath && ( - <img - src={imagePath} - height={9} - width={9} - /> - ) - } + { + imagePath && ( + <img + src={imagePath} + height={9} + width={9} + /> + ) + } </div> ) } diff --git a/ui/app/components/app/transaction-list-item-details/transaction-list-item-details.component.js b/ui/app/components/app/transaction-list-item-details/transaction-list-item-details.component.js index 21f14c045..d8dd965fc 100644 --- a/ui/app/components/app/transaction-list-item-details/transaction-list-item-details.component.js +++ b/ui/app/components/app/transaction-list-item-details/transaction-list-item-details.component.js @@ -166,7 +166,7 @@ export default class TransactionListItemDetails extends PureComponent { onClick={this.handleEtherscanClick} className="transaction-list-item-details__header-button" disabled={!hash} - > + > <img src="/images/arrow-popout.svg" /> </Button> </Tooltip> diff --git a/ui/app/components/app/transaction-list/transaction-list.component.js b/ui/app/components/app/transaction-list/transaction-list.component.js index d4232f448..3c096e3fd 100644 --- a/ui/app/components/app/transaction-list/transaction-list.component.js +++ b/ui/app/components/app/transaction-list/transaction-list.component.js @@ -75,8 +75,8 @@ export default class TransactionList extends PureComponent { { completedTransactions.length > 0 ? completedTransactions.map((transactionGroup, index) => ( - this.renderTransaction(transactionGroup, index) - )) + this.renderTransaction(transactionGroup, index) + )) : this.renderEmpty() } </div> diff --git a/ui/app/components/app/transaction-view-balance/transaction-view-balance.component.js b/ui/app/components/app/transaction-view-balance/transaction-view-balance.component.js index 3f6abbb00..feb701dbe 100644 --- a/ui/app/components/app/transaction-view-balance/transaction-view-balance.component.js +++ b/ui/app/components/app/transaction-view-balance/transaction-view-balance.component.js @@ -43,38 +43,38 @@ export default class TransactionViewBalance extends PureComponent { /> </div> ) : ( - <Tooltip position="top" title={this.context.t('balanceOutdated')} disabled={!balanceIsCached}> - <div className="transaction-view-balance__balance"> - <div className="transaction-view-balance__primary-container"> - <UserPreferencedCurrencyDisplay - className={classnames('transaction-view-balance__primary-balance', { - 'transaction-view-balance__cached-balance': balanceIsCached, - })} - value={balance} - type={PRIMARY} - ethNumberOfDecimals={4} - hideTitle={true} - /> - { - balanceIsCached ? <span className="transaction-view-balance__cached-star">*</span> : null - } - </div> - { - showFiat && ( - <UserPreferencedCurrencyDisplay - className={classnames({ - 'transaction-view-balance__cached-secondary-balance': balanceIsCached, - 'transaction-view-balance__secondary-balance': !balanceIsCached, - })} - value={balance} - type={SECONDARY} - ethNumberOfDecimals={4} - hideTitle={true} - /> - ) - } + <Tooltip position="top" title={this.context.t('balanceOutdated')} disabled={!balanceIsCached}> + <div className="transaction-view-balance__balance"> + <div className="transaction-view-balance__primary-container"> + <UserPreferencedCurrencyDisplay + className={classnames('transaction-view-balance__primary-balance', { + 'transaction-view-balance__cached-balance': balanceIsCached, + })} + value={balance} + type={PRIMARY} + ethNumberOfDecimals={4} + hideTitle={true} + /> + { + balanceIsCached ? <span className="transaction-view-balance__cached-star">*</span> : null + } </div> - </Tooltip> + { + showFiat && ( + <UserPreferencedCurrencyDisplay + className={classnames({ + 'transaction-view-balance__cached-secondary-balance': balanceIsCached, + 'transaction-view-balance__secondary-balance': !balanceIsCached, + })} + value={balance} + type={SECONDARY} + ethNumberOfDecimals={4} + hideTitle={true} + /> + ) + } + </div> + </Tooltip> ) } diff --git a/ui/app/components/ui/alert/index.js b/ui/app/components/ui/alert/index.js index b1229f502..da2ca4b66 100644 --- a/ui/app/components/ui/alert/index.js +++ b/ui/app/components/ui/alert/index.js @@ -4,59 +4,59 @@ const h = require('react-hyperscript') class Alert extends Component { - constructor (props) { - super(props) - - this.state = { - visble: false, - msg: false, - className: '', - } - } - - componentWillReceiveProps (nextProps) { - if (!this.props.visible && nextProps.visible) { - this.animateIn(nextProps) - } else if (this.props.visible && !nextProps.visible) { - this.animateOut() - } - } + constructor (props) { + super(props) - animateIn (props) { - this.setState({ - msg: props.msg, - visible: true, - className: '.visible', - }) + this.state = { + visble: false, + msg: false, + className: '', } + } - animateOut () { - this.setState({ - msg: null, - className: '.hidden', - }) - - setTimeout(_ => { - this.setState({visible: false}) - }, 500) - + componentWillReceiveProps (nextProps) { + if (!this.props.visible && nextProps.visible) { + this.animateIn(nextProps) + } else if (this.props.visible && !nextProps.visible) { + this.animateOut() } - - render () { - if (this.state.visible) { - return ( - h(`div.global-alert${this.state.className}`, {}, - h('a.msg', {}, this.state.msg) - ) - ) - } - return null + } + + animateIn (props) { + this.setState({ + msg: props.msg, + visible: true, + className: '.visible', + }) + } + + animateOut () { + this.setState({ + msg: null, + className: '.hidden', + }) + + setTimeout(_ => { + this.setState({visible: false}) + }, 500) + + } + + render () { + if (this.state.visible) { + return ( + h(`div.global-alert${this.state.className}`, {}, + h('a.msg', {}, this.state.msg) + ) + ) } + return null + } } Alert.propTypes = { - visible: PropTypes.bool.isRequired, - msg: PropTypes.string, + visible: PropTypes.bool.isRequired, + msg: PropTypes.string, } module.exports = Alert diff --git a/ui/app/components/ui/button-group/tests/button-group-component.test.js b/ui/app/components/ui/button-group/tests/button-group-component.test.js index 0bece90d6..f2e512445 100644 --- a/ui/app/components/ui/button-group/tests/button-group-component.test.js +++ b/ui/app/components/ui/button-group/tests/button-group-component.test.js @@ -59,40 +59,40 @@ describe('ButtonGroup Component', function () { describe('renderButtons', () => { it('should render a button for each child', () => { - const childButtons = wrapper.find('.button-group__button') - assert.equal(childButtons.length, 3) + const childButtons = wrapper.find('.button-group__button') + assert.equal(childButtons.length, 3) }) it('should render the correct button with an active state', () => { - const childButtons = wrapper.find('.button-group__button') - const activeChildButton = wrapper.find('.button-group__button--active') - assert.deepEqual(childButtons.get(1), activeChildButton.get(0)) + const childButtons = wrapper.find('.button-group__button') + const activeChildButton = wrapper.find('.button-group__button--active') + assert.deepEqual(childButtons.get(1), activeChildButton.get(0)) }) it('should call handleButtonClick and the respective button\'s onClick method when a button is clicked', () => { - assert.equal(ButtonGroup.prototype.handleButtonClick.callCount, 0) - assert.equal(childButtonSpies.onClick.callCount, 0) - const childButtons = wrapper.find('.button-group__button') - childButtons.at(0).props().onClick() - childButtons.at(1).props().onClick() - childButtons.at(2).props().onClick() - assert.equal(ButtonGroup.prototype.handleButtonClick.callCount, 3) - assert.equal(childButtonSpies.onClick.callCount, 3) + assert.equal(ButtonGroup.prototype.handleButtonClick.callCount, 0) + assert.equal(childButtonSpies.onClick.callCount, 0) + const childButtons = wrapper.find('.button-group__button') + childButtons.at(0).props().onClick() + childButtons.at(1).props().onClick() + childButtons.at(2).props().onClick() + assert.equal(ButtonGroup.prototype.handleButtonClick.callCount, 3) + assert.equal(childButtonSpies.onClick.callCount, 3) }) it('should render all child buttons as disabled if props.disabled is true', () => { - const childButtons = wrapper.find('.button-group__button') - childButtons.forEach(button => { - assert.equal(button.props().disabled, undefined) - }) - wrapper.setProps({ disabled: true }) - const disabledChildButtons = wrapper.find('[disabled=true]') - assert.equal(disabledChildButtons.length, 3) + const childButtons = wrapper.find('.button-group__button') + childButtons.forEach(button => { + assert.equal(button.props().disabled, undefined) + }) + wrapper.setProps({ disabled: true }) + const disabledChildButtons = wrapper.find('[disabled=true]') + assert.equal(disabledChildButtons.length, 3) }) it('should render the children of the button', () => { - const mockClass = wrapper.find('.mockClass') - assert.equal(mockClass.length, 1) + const mockClass = wrapper.find('.mockClass') + assert.equal(mockClass.length, 1) }) }) @@ -103,9 +103,9 @@ describe('ButtonGroup Component', function () { }) it('should call renderButtons when rendering', () => { - assert.equal(ButtonGroup.prototype.renderButtons.callCount, 1) - wrapper.instance().render() - assert.equal(ButtonGroup.prototype.renderButtons.callCount, 2) + assert.equal(ButtonGroup.prototype.renderButtons.callCount, 1) + wrapper.instance().render() + assert.equal(ButtonGroup.prototype.renderButtons.callCount, 2) }) }) }) diff --git a/ui/app/components/ui/currency-input/currency-input.component.js b/ui/app/components/ui/currency-input/currency-input.component.js index 1876c9591..f7db2b829 100644 --- a/ui/app/components/ui/currency-input/currency-input.component.js +++ b/ui/app/components/ui/currency-input/currency-input.component.js @@ -141,22 +141,22 @@ export default class CurrencyInput extends PureComponent { const { decimalValue } = this.state return ( - <UnitInput - {...restProps} - suffix={this.shouldUseFiat() ? fiatSuffix : nativeSuffix} - onChange={this.handleChange} - onBlur={this.handleBlur} - value={decimalValue} - maxModeOn={maxModeOn} - actionComponent={( - <div - className="currency-input__swap-component" - onClick={this.swap} - /> - )} - > - { this.renderConversionComponent() } - </UnitInput> + <UnitInput + {...restProps} + suffix={this.shouldUseFiat() ? fiatSuffix : nativeSuffix} + onChange={this.handleChange} + onBlur={this.handleBlur} + value={decimalValue} + maxModeOn={maxModeOn} + actionComponent={( + <div + className="currency-input__swap-component" + onClick={this.swap} + /> + )} + > + { this.renderConversionComponent() } + </UnitInput> ) } } diff --git a/ui/app/components/ui/sender-to-recipient/sender-to-recipient.component.js b/ui/app/components/ui/sender-to-recipient/sender-to-recipient.component.js index 57b595d48..a98a94101 100644 --- a/ui/app/components/ui/sender-to-recipient/sender-to-recipient.component.js +++ b/ui/app/components/ui/sender-to-recipient/sender-to-recipient.component.js @@ -64,10 +64,10 @@ export default class SenderToRecipient extends PureComponent { containerClassName="sender-to-recipient__tooltip-container" onHidden={() => this.setState({ senderAddressCopied: false })} > - <div className="sender-to-recipient__name"> - { addressOnly ? `${t('from')}: ${checksummedSenderAddress}` : senderName } - </div> - </Tooltip> + <div className="sender-to-recipient__name"> + { addressOnly ? `${t('from')}: ${checksummedSenderAddress}` : senderName } + </div> + </Tooltip> ) } |