diff --git a/ui/app/actions.js b/ui/app/actions.js index 1fb49c920..0aeb802f8 100644 --- a/ui/app/actions.js +++ b/ui/app/actions.js @@ -6,7 +6,7 @@ const { calcGasTotal, calcTokenBalance, estimateGas, -} = require('./components/send_/send.utils') +} = require('./components/send/send.utils') const ethUtil = require('ethereumjs-util') const { fetchLocale } = require('../i18n-helper') const log = require('loglevel') diff --git a/ui/app/app.js b/ui/app/app.js index 74d360d3c..a00692df0 100644 --- a/ui/app/app.js +++ b/ui/app/app.js @@ -11,7 +11,7 @@ const log = require('loglevel') // init const InitializeScreen = require('../../mascara/src/app/first-time').default // accounts -const SendTransactionScreen = require('./components/send_/send.container') +const SendTransactionScreen = require('./components/send/send.container') const ConfirmTransaction = require('./components/pages/confirm-transaction') // slideout menu diff --git a/ui/app/components/customize-gas-modal/index.js b/ui/app/components/customize-gas-modal/index.js index cefa428b9..c255fd64d 100644 --- a/ui/app/components/customize-gas-modal/index.js +++ b/ui/app/components/customize-gas-modal/index.js @@ -16,11 +16,11 @@ const { MIN_GAS_PRICE_DEC, MIN_GAS_LIMIT_DEC, MIN_GAS_PRICE_GWEI, -} = require('../send_/send.constants') +} = require('../send/send.constants') const { isBalanceSufficient, -} = require('../send_/send.utils') +} = require('../send/send.utils') const { conversionUtil, @@ -45,7 +45,7 @@ const { const { getGasPrice, getGasLimit, -} = require('../send_/send.selectors') +} = require('../send/send.selectors') function mapStateToProps (state) { const selectedToken = getSelectedToken(state) diff --git a/ui/app/components/dropdowns/account-dropdown-mini.js b/ui/app/components/dropdowns/account-dropdown-mini.js index a7a908d3b..261eb0aa2 100644 --- a/ui/app/components/dropdowns/account-dropdown-mini.js +++ b/ui/app/components/dropdowns/account-dropdown-mini.js @@ -1,7 +1,7 @@ const Component = require('react').Component const h = require('react-hyperscript') const inherits = require('util').inherits -const AccountListItem = require('../send_/account-list-item/account-list-item.component').default +const AccountListItem = require('../send/account-list-item/account-list-item.component').default module.exports = AccountDropdownMini diff --git a/ui/app/components/ens-input.js b/ui/app/components/ens-input.js index adbf2dba8..b9f99b3d1 100644 --- a/ui/app/components/ens-input.js +++ b/ui/app/components/ens-input.js @@ -10,7 +10,7 @@ const networkMap = require('ethjs-ens/lib/network-map.json') const ensRE = /.+\..+$/ const ZERO_ADDRESS = '0x0000000000000000000000000000000000000000' const connect = require('react-redux').connect -const ToAutoComplete = require('./send/to-autocomplete.component').default +const ToAutoComplete = require('./send/to-autocomplete').default const log = require('loglevel') const { isValidENSAddress } = require('../util') diff --git a/ui/app/components/pending-tx/confirm-deploy-contract.js b/ui/app/components/pending-tx/confirm-deploy-contract.js index af3a14f57..a059d1a32 100644 --- a/ui/app/components/pending-tx/confirm-deploy-contract.js +++ b/ui/app/components/pending-tx/confirm-deploy-contract.js @@ -11,7 +11,7 @@ const { conversionUtil } = require('../../conversion-util') const SenderToRecipient = require('../sender-to-recipient') const NetworkDisplay = require('../network-display') -const { MIN_GAS_PRICE_HEX } = require('../send_/send.constants') +const { MIN_GAS_PRICE_HEX } = require('../send/send.constants') class ConfirmDeployContract extends Component { constructor (props) { diff --git a/ui/app/components/pending-tx/confirm-send-ether.js b/ui/app/components/pending-tx/confirm-send-ether.js index 22b2670d8..67f54aa26 100644 --- a/ui/app/components/pending-tx/confirm-send-ether.js +++ b/ui/app/components/pending-tx/confirm-send-ether.js @@ -19,14 +19,14 @@ const { const { calcGasTotal, isBalanceSufficient, -} = require('../send_/send.utils') -const GasFeeDisplay = require('../send_/send-content/send-gas-row/gas-fee-display/gas-fee-display.component').default +} = require('../send/send.utils') +const GasFeeDisplay = require('../send/send-content/send-gas-row/gas-fee-display/').default const SenderToRecipient = require('../sender-to-recipient') const NetworkDisplay = require('../network-display') const currencyFormatter = require('currency-formatter') const currencies = require('currency-formatter/currencies') -const { MIN_GAS_PRICE_HEX } = require('../send_/send.constants') +const { MIN_GAS_PRICE_HEX } = require('../send/send.constants') const { SEND_ROUTE, DEFAULT_ROUTE } = require('../../routes') const { ENVIRONMENT_TYPE_POPUP, diff --git a/ui/app/components/pending-tx/confirm-send-token.js b/ui/app/components/pending-tx/confirm-send-token.js index 535347cee..818853882 100644 --- a/ui/app/components/pending-tx/confirm-send-token.js +++ b/ui/app/components/pending-tx/confirm-send-token.js @@ -11,7 +11,7 @@ abiDecoder.addABI(tokenAbi) const actions = require('../../actions') const clone = require('clone') const Identicon = require('../identicon') -const GasFeeDisplay = require('../send_/send-content/send-gas-row/gas-fee-display/gas-fee-display.component.js').default +const GasFeeDisplay = require('../send/send-content/send-gas-row/gas-fee-display/').default const NetworkDisplay = require('../network-display') const ethUtil = require('ethereumjs-util') const BN = ethUtil.BN @@ -23,7 +23,7 @@ const { const { calcGasTotal, isBalanceSufficient, -} = require('../send_/send.utils') +} = require('../send/send.utils') const { calcTokenAmount, } = require('../../token-util') @@ -31,7 +31,7 @@ const classnames = require('classnames') const currencyFormatter = require('currency-formatter') const currencies = require('currency-formatter/currencies') -const { MIN_GAS_PRICE_HEX } = require('../send_/send.constants') +const { MIN_GAS_PRICE_HEX } = require('../send/send.constants') const { getTokenExchangeRate, diff --git a/ui/app/components/send_/README.md b/ui/app/components/send/README.md similarity index 100% rename from ui/app/components/send_/README.md rename to ui/app/components/send/README.md diff --git a/ui/app/components/send_/account-list-item/account-list-item-README.md b/ui/app/components/send/account-list-item/account-list-item-README.md similarity index 100% rename from ui/app/components/send_/account-list-item/account-list-item-README.md rename to ui/app/components/send/account-list-item/account-list-item-README.md diff --git a/ui/app/components/send_/account-list-item/account-list-item.component.js b/ui/app/components/send/account-list-item/account-list-item.component.js similarity index 97% rename from ui/app/components/send_/account-list-item/account-list-item.component.js rename to ui/app/components/send/account-list-item/account-list-item.component.js index 322246f61..9f4a96e61 100644 --- a/ui/app/components/send_/account-list-item/account-list-item.component.js +++ b/ui/app/components/send/account-list-item/account-list-item.component.js @@ -2,7 +2,7 @@ import React, { Component } from 'react' import PropTypes from 'prop-types' import { checksumAddress } from '../../../util' import Identicon from '../../identicon' -import CurrencyDisplay from '../../send/currency-display' +import CurrencyDisplay from '../currency-display' export default class AccountListItem extends Component { diff --git a/ui/app/components/send_/account-list-item/account-list-item.container.js b/ui/app/components/send/account-list-item/account-list-item.container.js similarity index 100% rename from ui/app/components/send_/account-list-item/account-list-item.container.js rename to ui/app/components/send/account-list-item/account-list-item.container.js diff --git a/ui/app/components/send_/account-list-item/account-list-item.scss b/ui/app/components/send/account-list-item/account-list-item.scss similarity index 100% rename from ui/app/components/send_/account-list-item/account-list-item.scss rename to ui/app/components/send/account-list-item/account-list-item.scss diff --git a/ui/app/components/send_/account-list-item/index.js b/ui/app/components/send/account-list-item/index.js similarity index 100% rename from ui/app/components/send_/account-list-item/index.js rename to ui/app/components/send/account-list-item/index.js diff --git a/ui/app/components/send_/account-list-item/tests/account-list-item-component.test.js b/ui/app/components/send/account-list-item/tests/account-list-item-component.test.js similarity index 98% rename from ui/app/components/send_/account-list-item/tests/account-list-item-component.test.js rename to ui/app/components/send/account-list-item/tests/account-list-item-component.test.js index bb7f3776c..ef152d2e7 100644 --- a/ui/app/components/send_/account-list-item/tests/account-list-item-component.test.js +++ b/ui/app/components/send/account-list-item/tests/account-list-item-component.test.js @@ -4,7 +4,7 @@ import { shallow } from 'enzyme' import sinon from 'sinon' import proxyquire from 'proxyquire' import Identicon from '../../../identicon' -import CurrencyDisplay from '../../../send/currency-display' +import CurrencyDisplay from '../../currency-display' const utilsMethodStubs = { checksumAddress: sinon.stub().returns('mockCheckSumAddress'), diff --git a/ui/app/components/send_/account-list-item/tests/account-list-item-container.test.js b/ui/app/components/send/account-list-item/tests/account-list-item-container.test.js similarity index 100% rename from ui/app/components/send_/account-list-item/tests/account-list-item-container.test.js rename to ui/app/components/send/account-list-item/tests/account-list-item-container.test.js diff --git a/ui/app/components/send/currency-display.js b/ui/app/components/send/currency-display/currency-display.js similarity index 97% rename from ui/app/components/send/currency-display.js rename to ui/app/components/send/currency-display/currency-display.js index 1cf55ce1a..1b9f7738c 100644 --- a/ui/app/components/send/currency-display.js +++ b/ui/app/components/send/currency-display/currency-display.js @@ -1,8 +1,8 @@ const Component = require('react').Component const h = require('react-hyperscript') const inherits = require('util').inherits -const { conversionUtil, multiplyCurrencies } = require('../../conversion-util') -const { removeLeadingZeroes } = require('../send_/send.utils') +const { conversionUtil, multiplyCurrencies } = require('../../../conversion-util') +const { removeLeadingZeroes } = require('../send.utils') const currencyFormatter = require('currency-formatter') const currencies = require('currency-formatter/currencies') const ethUtil = require('ethereumjs-util') diff --git a/ui/app/components/send/currency-display/index.js b/ui/app/components/send/currency-display/index.js new file mode 100644 index 000000000..0185a19e9 --- /dev/null +++ b/ui/app/components/send/currency-display/index.js @@ -0,0 +1 @@ +export { default } from './currency-display.js' \ No newline at end of file diff --git a/ui/app/components/send_/index.js b/ui/app/components/send/index.js similarity index 100% rename from ui/app/components/send_/index.js rename to ui/app/components/send/index.js diff --git a/ui/app/components/send_/send-content/index.js b/ui/app/components/send/send-content/index.js similarity index 100% rename from ui/app/components/send_/send-content/index.js rename to ui/app/components/send/send-content/index.js diff --git a/ui/app/components/send_/send-content/send-amount-row/README.md b/ui/app/components/send/send-content/send-amount-row/README.md similarity index 100% rename from ui/app/components/send_/send-content/send-amount-row/README.md rename to ui/app/components/send/send-content/send-amount-row/README.md diff --git a/ui/app/components/send_/send-content/send-amount-row/amount-max-button/amount-max-button.component.js b/ui/app/components/send/send-content/send-amount-row/amount-max-button/amount-max-button.component.js similarity index 100% rename from ui/app/components/send_/send-content/send-amount-row/amount-max-button/amount-max-button.component.js rename to ui/app/components/send/send-content/send-amount-row/amount-max-button/amount-max-button.component.js diff --git a/ui/app/components/send_/send-content/send-amount-row/amount-max-button/amount-max-button.container.js b/ui/app/components/send/send-content/send-amount-row/amount-max-button/amount-max-button.container.js similarity index 100% rename from ui/app/components/send_/send-content/send-amount-row/amount-max-button/amount-max-button.container.js rename to ui/app/components/send/send-content/send-amount-row/amount-max-button/amount-max-button.container.js diff --git a/ui/app/components/send_/send-content/send-amount-row/amount-max-button/amount-max-button.selectors.js b/ui/app/components/send/send-content/send-amount-row/amount-max-button/amount-max-button.selectors.js similarity index 100% rename from ui/app/components/send_/send-content/send-amount-row/amount-max-button/amount-max-button.selectors.js rename to ui/app/components/send/send-content/send-amount-row/amount-max-button/amount-max-button.selectors.js diff --git a/ui/app/components/send_/send-content/send-amount-row/amount-max-button/amount-max-button.utils.js b/ui/app/components/send/send-content/send-amount-row/amount-max-button/amount-max-button.utils.js similarity index 100% rename from ui/app/components/send_/send-content/send-amount-row/amount-max-button/amount-max-button.utils.js rename to ui/app/components/send/send-content/send-amount-row/amount-max-button/amount-max-button.utils.js diff --git a/ui/app/components/send_/send-content/send-amount-row/amount-max-button/index.js b/ui/app/components/send/send-content/send-amount-row/amount-max-button/index.js similarity index 100% rename from ui/app/components/send_/send-content/send-amount-row/amount-max-button/index.js rename to ui/app/components/send/send-content/send-amount-row/amount-max-button/index.js diff --git a/ui/app/components/send_/send-content/send-amount-row/amount-max-button/tests/amount-max-button-component.test.js b/ui/app/components/send/send-content/send-amount-row/amount-max-button/tests/amount-max-button-component.test.js similarity index 100% rename from ui/app/components/send_/send-content/send-amount-row/amount-max-button/tests/amount-max-button-component.test.js rename to ui/app/components/send/send-content/send-amount-row/amount-max-button/tests/amount-max-button-component.test.js diff --git a/ui/app/components/send_/send-content/send-amount-row/amount-max-button/tests/amount-max-button-container.test.js b/ui/app/components/send/send-content/send-amount-row/amount-max-button/tests/amount-max-button-container.test.js similarity index 100% rename from ui/app/components/send_/send-content/send-amount-row/amount-max-button/tests/amount-max-button-container.test.js rename to ui/app/components/send/send-content/send-amount-row/amount-max-button/tests/amount-max-button-container.test.js diff --git a/ui/app/components/send_/send-content/send-amount-row/amount-max-button/tests/amount-max-button-selectors.test.js b/ui/app/components/send/send-content/send-amount-row/amount-max-button/tests/amount-max-button-selectors.test.js similarity index 100% rename from ui/app/components/send_/send-content/send-amount-row/amount-max-button/tests/amount-max-button-selectors.test.js rename to ui/app/components/send/send-content/send-amount-row/amount-max-button/tests/amount-max-button-selectors.test.js diff --git a/ui/app/components/send_/send-content/send-amount-row/amount-max-button/tests/amount-max-button-utils.test.js b/ui/app/components/send/send-content/send-amount-row/amount-max-button/tests/amount-max-button-utils.test.js similarity index 100% rename from ui/app/components/send_/send-content/send-amount-row/amount-max-button/tests/amount-max-button-utils.test.js rename to ui/app/components/send/send-content/send-amount-row/amount-max-button/tests/amount-max-button-utils.test.js diff --git a/ui/app/components/send_/send-content/send-amount-row/index.js b/ui/app/components/send/send-content/send-amount-row/index.js similarity index 100% rename from ui/app/components/send_/send-content/send-amount-row/index.js rename to ui/app/components/send/send-content/send-amount-row/index.js diff --git a/ui/app/components/send_/send-content/send-amount-row/send-amount-row.component.js b/ui/app/components/send/send-content/send-amount-row/send-amount-row.component.js similarity index 97% rename from ui/app/components/send_/send-content/send-amount-row/send-amount-row.component.js rename to ui/app/components/send/send-content/send-amount-row/send-amount-row.component.js index 6e30d29a4..c548a5695 100644 --- a/ui/app/components/send_/send-content/send-amount-row/send-amount-row.component.js +++ b/ui/app/components/send/send-content/send-amount-row/send-amount-row.component.js @@ -2,7 +2,7 @@ import React, { Component } from 'react' import PropTypes from 'prop-types' import SendRowWrapper from '../send-row-wrapper/' import AmountMaxButton from './amount-max-button/' -import CurrencyDisplay from '../../../send/currency-display' +import CurrencyDisplay from '../../currency-display' export default class SendAmountRow extends Component { diff --git a/ui/app/components/send_/send-content/send-amount-row/send-amount-row.container.js b/ui/app/components/send/send-content/send-amount-row/send-amount-row.container.js similarity index 100% rename from ui/app/components/send_/send-content/send-amount-row/send-amount-row.container.js rename to ui/app/components/send/send-content/send-amount-row/send-amount-row.container.js diff --git a/ui/app/components/send_/send-content/send-amount-row/send-amount-row.scss b/ui/app/components/send/send-content/send-amount-row/send-amount-row.scss similarity index 100% rename from ui/app/components/send_/send-content/send-amount-row/send-amount-row.scss rename to ui/app/components/send/send-content/send-amount-row/send-amount-row.scss diff --git a/ui/app/components/send_/send-content/send-amount-row/send-amount-row.selectors.js b/ui/app/components/send/send-content/send-amount-row/send-amount-row.selectors.js similarity index 100% rename from ui/app/components/send_/send-content/send-amount-row/send-amount-row.selectors.js rename to ui/app/components/send/send-content/send-amount-row/send-amount-row.selectors.js diff --git a/ui/app/components/send_/send-content/send-amount-row/tests/send-amount-row-component.test.js b/ui/app/components/send/send-content/send-amount-row/tests/send-amount-row-component.test.js similarity index 99% rename from ui/app/components/send_/send-content/send-amount-row/tests/send-amount-row-component.test.js rename to ui/app/components/send/send-content/send-amount-row/tests/send-amount-row-component.test.js index 95c000a34..8425e076e 100644 --- a/ui/app/components/send_/send-content/send-amount-row/tests/send-amount-row-component.test.js +++ b/ui/app/components/send/send-content/send-amount-row/tests/send-amount-row-component.test.js @@ -6,7 +6,7 @@ import SendAmountRow from '../send-amount-row.component.js' import SendRowWrapper from '../../send-row-wrapper/send-row-wrapper.component' import AmountMaxButton from '../amount-max-button/amount-max-button.container' -import CurrencyDisplay from '../../../../send/currency-display' +import CurrencyDisplay from '../../../currency-display' const propsMethodSpies = { setMaxModeTo: sinon.spy(), diff --git a/ui/app/components/send_/send-content/send-amount-row/tests/send-amount-row-container.test.js b/ui/app/components/send/send-content/send-amount-row/tests/send-amount-row-container.test.js similarity index 100% rename from ui/app/components/send_/send-content/send-amount-row/tests/send-amount-row-container.test.js rename to ui/app/components/send/send-content/send-amount-row/tests/send-amount-row-container.test.js diff --git a/ui/app/components/send_/send-content/send-amount-row/tests/send-amount-row-selectors.test.js b/ui/app/components/send/send-content/send-amount-row/tests/send-amount-row-selectors.test.js similarity index 100% rename from ui/app/components/send_/send-content/send-amount-row/tests/send-amount-row-selectors.test.js rename to ui/app/components/send/send-content/send-amount-row/tests/send-amount-row-selectors.test.js diff --git a/ui/app/components/send_/send-content/send-content-README.md b/ui/app/components/send/send-content/send-content-README.md similarity index 100% rename from ui/app/components/send_/send-content/send-content-README.md rename to ui/app/components/send/send-content/send-content-README.md diff --git a/ui/app/components/send_/send-content/send-content.component.js b/ui/app/components/send/send-content/send-content.component.js similarity index 100% rename from ui/app/components/send_/send-content/send-content.component.js rename to ui/app/components/send/send-content/send-content.component.js diff --git a/ui/app/components/send_/send-content/send-content.scss b/ui/app/components/send/send-content/send-content.scss similarity index 100% rename from ui/app/components/send_/send-content/send-content.scss rename to ui/app/components/send/send-content/send-content.scss diff --git a/ui/app/components/send_/send-content/send-dropdown-list/index.js b/ui/app/components/send/send-content/send-dropdown-list/index.js similarity index 100% rename from ui/app/components/send_/send-content/send-dropdown-list/index.js rename to ui/app/components/send/send-content/send-dropdown-list/index.js diff --git a/ui/app/components/send_/send-content/send-dropdown-list/send-dropdown-list.component.js b/ui/app/components/send/send-content/send-dropdown-list/send-dropdown-list.component.js similarity index 100% rename from ui/app/components/send_/send-content/send-dropdown-list/send-dropdown-list.component.js rename to ui/app/components/send/send-content/send-dropdown-list/send-dropdown-list.component.js diff --git a/ui/app/components/send_/send-content/send-dropdown-list/tests/send-dropdown-list-component.test.js b/ui/app/components/send/send-content/send-dropdown-list/tests/send-dropdown-list-component.test.js similarity index 100% rename from ui/app/components/send_/send-content/send-dropdown-list/tests/send-dropdown-list-component.test.js rename to ui/app/components/send/send-content/send-dropdown-list/tests/send-dropdown-list-component.test.js diff --git a/ui/app/components/send_/send-content/send-from-row/from-dropdown/from-dropdown-README.md b/ui/app/components/send/send-content/send-from-row/from-dropdown/from-dropdown-README.md similarity index 100% rename from ui/app/components/send_/send-content/send-from-row/from-dropdown/from-dropdown-README.md rename to ui/app/components/send/send-content/send-from-row/from-dropdown/from-dropdown-README.md diff --git a/ui/app/components/send_/send-content/send-from-row/from-dropdown/from-dropdown.component.js b/ui/app/components/send/send-content/send-from-row/from-dropdown/from-dropdown.component.js similarity index 100% rename from ui/app/components/send_/send-content/send-from-row/from-dropdown/from-dropdown.component.js rename to ui/app/components/send/send-content/send-from-row/from-dropdown/from-dropdown.component.js diff --git a/ui/app/components/send_/send-content/send-from-row/from-dropdown/from-dropdown.scss b/ui/app/components/send/send-content/send-from-row/from-dropdown/from-dropdown.scss similarity index 100% rename from ui/app/components/send_/send-content/send-from-row/from-dropdown/from-dropdown.scss rename to ui/app/components/send/send-content/send-from-row/from-dropdown/from-dropdown.scss diff --git a/ui/app/components/send_/send-content/send-from-row/from-dropdown/index.js b/ui/app/components/send/send-content/send-from-row/from-dropdown/index.js similarity index 100% rename from ui/app/components/send_/send-content/send-from-row/from-dropdown/index.js rename to ui/app/components/send/send-content/send-from-row/from-dropdown/index.js diff --git a/ui/app/components/send_/send-content/send-from-row/from-dropdown/tests/from-dropdown-component.test.js b/ui/app/components/send/send-content/send-from-row/from-dropdown/tests/from-dropdown-component.test.js similarity index 100% rename from ui/app/components/send_/send-content/send-from-row/from-dropdown/tests/from-dropdown-component.test.js rename to ui/app/components/send/send-content/send-from-row/from-dropdown/tests/from-dropdown-component.test.js diff --git a/ui/app/components/send_/send-content/send-from-row/index.js b/ui/app/components/send/send-content/send-from-row/index.js similarity index 100% rename from ui/app/components/send_/send-content/send-from-row/index.js rename to ui/app/components/send/send-content/send-from-row/index.js diff --git a/ui/app/components/send_/send-content/send-from-row/send-from-row-README.md b/ui/app/components/send/send-content/send-from-row/send-from-row-README.md similarity index 100% rename from ui/app/components/send_/send-content/send-from-row/send-from-row-README.md rename to ui/app/components/send/send-content/send-from-row/send-from-row-README.md diff --git a/ui/app/components/send_/send-content/send-from-row/send-from-row.component.js b/ui/app/components/send/send-content/send-from-row/send-from-row.component.js similarity index 100% rename from ui/app/components/send_/send-content/send-from-row/send-from-row.component.js rename to ui/app/components/send/send-content/send-from-row/send-from-row.component.js diff --git a/ui/app/components/send_/send-content/send-from-row/send-from-row.container.js b/ui/app/components/send/send-content/send-from-row/send-from-row.container.js similarity index 100% rename from ui/app/components/send_/send-content/send-from-row/send-from-row.container.js rename to ui/app/components/send/send-content/send-from-row/send-from-row.container.js diff --git a/ui/app/components/send_/send-content/send-from-row/send-from-row.selectors.js b/ui/app/components/send/send-content/send-from-row/send-from-row.selectors.js similarity index 100% rename from ui/app/components/send_/send-content/send-from-row/send-from-row.selectors.js rename to ui/app/components/send/send-content/send-from-row/send-from-row.selectors.js diff --git a/ui/app/components/send_/send-content/send-from-row/tests/send-from-row-component.test.js b/ui/app/components/send/send-content/send-from-row/tests/send-from-row-component.test.js similarity index 100% rename from ui/app/components/send_/send-content/send-from-row/tests/send-from-row-component.test.js rename to ui/app/components/send/send-content/send-from-row/tests/send-from-row-component.test.js diff --git a/ui/app/components/send_/send-content/send-from-row/tests/send-from-row-container.test.js b/ui/app/components/send/send-content/send-from-row/tests/send-from-row-container.test.js similarity index 100% rename from ui/app/components/send_/send-content/send-from-row/tests/send-from-row-container.test.js rename to ui/app/components/send/send-content/send-from-row/tests/send-from-row-container.test.js diff --git a/ui/app/components/send_/send-content/send-from-row/tests/send-from-row-selectors.test.js b/ui/app/components/send/send-content/send-from-row/tests/send-from-row-selectors.test.js similarity index 100% rename from ui/app/components/send_/send-content/send-from-row/tests/send-from-row-selectors.test.js rename to ui/app/components/send/send-content/send-from-row/tests/send-from-row-selectors.test.js diff --git a/ui/app/components/send_/send-content/send-gas-row/README.md b/ui/app/components/send/send-content/send-gas-row/README.md similarity index 100% rename from ui/app/components/send_/send-content/send-gas-row/README.md rename to ui/app/components/send/send-content/send-gas-row/README.md diff --git a/ui/app/components/send_/send-content/send-gas-row/gas-fee-display/gas-fee-display.component.js b/ui/app/components/send/send-content/send-gas-row/gas-fee-display/gas-fee-display.component.js similarity index 100% rename from ui/app/components/send_/send-content/send-gas-row/gas-fee-display/gas-fee-display.component.js rename to ui/app/components/send/send-content/send-gas-row/gas-fee-display/gas-fee-display.component.js diff --git a/ui/app/components/send_/send-content/send-gas-row/gas-fee-display/index.js b/ui/app/components/send/send-content/send-gas-row/gas-fee-display/index.js similarity index 100% rename from ui/app/components/send_/send-content/send-gas-row/gas-fee-display/index.js rename to ui/app/components/send/send-content/send-gas-row/gas-fee-display/index.js diff --git a/ui/app/components/send_/send-content/send-gas-row/gas-fee-display/test/gas-fee-display.component.test.js b/ui/app/components/send/send-content/send-gas-row/gas-fee-display/test/gas-fee-display.component.test.js similarity index 100% rename from ui/app/components/send_/send-content/send-gas-row/gas-fee-display/test/gas-fee-display.component.test.js rename to ui/app/components/send/send-content/send-gas-row/gas-fee-display/test/gas-fee-display.component.test.js diff --git a/ui/app/components/send_/send-content/send-gas-row/index.js b/ui/app/components/send/send-content/send-gas-row/index.js similarity index 100% rename from ui/app/components/send_/send-content/send-gas-row/index.js rename to ui/app/components/send/send-content/send-gas-row/index.js diff --git a/ui/app/components/send_/send-content/send-gas-row/send-gas-row.component.js b/ui/app/components/send/send-content/send-gas-row/send-gas-row.component.js similarity index 100% rename from ui/app/components/send_/send-content/send-gas-row/send-gas-row.component.js rename to ui/app/components/send/send-content/send-gas-row/send-gas-row.component.js diff --git a/ui/app/components/send_/send-content/send-gas-row/send-gas-row.container.js b/ui/app/components/send/send-content/send-gas-row/send-gas-row.container.js similarity index 100% rename from ui/app/components/send_/send-content/send-gas-row/send-gas-row.container.js rename to ui/app/components/send/send-content/send-gas-row/send-gas-row.container.js diff --git a/ui/app/components/send_/send-content/send-gas-row/send-gas-row.scss b/ui/app/components/send/send-content/send-gas-row/send-gas-row.scss similarity index 100% rename from ui/app/components/send_/send-content/send-gas-row/send-gas-row.scss rename to ui/app/components/send/send-content/send-gas-row/send-gas-row.scss diff --git a/ui/app/components/send_/send-content/send-gas-row/send-gas-row.selectors.js b/ui/app/components/send/send-content/send-gas-row/send-gas-row.selectors.js similarity index 100% rename from ui/app/components/send_/send-content/send-gas-row/send-gas-row.selectors.js rename to ui/app/components/send/send-content/send-gas-row/send-gas-row.selectors.js diff --git a/ui/app/components/send_/send-content/send-gas-row/tests/send-gas-row-component.test.js b/ui/app/components/send/send-content/send-gas-row/tests/send-gas-row-component.test.js similarity index 100% rename from ui/app/components/send_/send-content/send-gas-row/tests/send-gas-row-component.test.js rename to ui/app/components/send/send-content/send-gas-row/tests/send-gas-row-component.test.js diff --git a/ui/app/components/send_/send-content/send-gas-row/tests/send-gas-row-container.test.js b/ui/app/components/send/send-content/send-gas-row/tests/send-gas-row-container.test.js similarity index 100% rename from ui/app/components/send_/send-content/send-gas-row/tests/send-gas-row-container.test.js rename to ui/app/components/send/send-content/send-gas-row/tests/send-gas-row-container.test.js diff --git a/ui/app/components/send_/send-content/send-gas-row/tests/send-gas-row-selectors.test.js b/ui/app/components/send/send-content/send-gas-row/tests/send-gas-row-selectors.test.js similarity index 100% rename from ui/app/components/send_/send-content/send-gas-row/tests/send-gas-row-selectors.test.js rename to ui/app/components/send/send-content/send-gas-row/tests/send-gas-row-selectors.test.js diff --git a/ui/app/components/send_/send-content/send-row-wrapper/index.js b/ui/app/components/send/send-content/send-row-wrapper/index.js similarity index 100% rename from ui/app/components/send_/send-content/send-row-wrapper/index.js rename to ui/app/components/send/send-content/send-row-wrapper/index.js diff --git a/ui/app/components/send_/send-content/send-row-wrapper/send-row-error-message/index.js b/ui/app/components/send/send-content/send-row-wrapper/send-row-error-message/index.js similarity index 100% rename from ui/app/components/send_/send-content/send-row-wrapper/send-row-error-message/index.js rename to ui/app/components/send/send-content/send-row-wrapper/send-row-error-message/index.js diff --git a/ui/app/components/send_/send-content/send-row-wrapper/send-row-error-message/send-row-error-message-README.md b/ui/app/components/send/send-content/send-row-wrapper/send-row-error-message/send-row-error-message-README.md similarity index 100% rename from ui/app/components/send_/send-content/send-row-wrapper/send-row-error-message/send-row-error-message-README.md rename to ui/app/components/send/send-content/send-row-wrapper/send-row-error-message/send-row-error-message-README.md diff --git a/ui/app/components/send_/send-content/send-row-wrapper/send-row-error-message/send-row-error-message.component.js b/ui/app/components/send/send-content/send-row-wrapper/send-row-error-message/send-row-error-message.component.js similarity index 100% rename from ui/app/components/send_/send-content/send-row-wrapper/send-row-error-message/send-row-error-message.component.js rename to ui/app/components/send/send-content/send-row-wrapper/send-row-error-message/send-row-error-message.component.js diff --git a/ui/app/components/send_/send-content/send-row-wrapper/send-row-error-message/send-row-error-message.container.js b/ui/app/components/send/send-content/send-row-wrapper/send-row-error-message/send-row-error-message.container.js similarity index 100% rename from ui/app/components/send_/send-content/send-row-wrapper/send-row-error-message/send-row-error-message.container.js rename to ui/app/components/send/send-content/send-row-wrapper/send-row-error-message/send-row-error-message.container.js diff --git a/ui/app/components/send_/send-content/send-row-wrapper/send-row-error-message/send-row-error-message.scss b/ui/app/components/send/send-content/send-row-wrapper/send-row-error-message/send-row-error-message.scss similarity index 100% rename from ui/app/components/send_/send-content/send-row-wrapper/send-row-error-message/send-row-error-message.scss rename to ui/app/components/send/send-content/send-row-wrapper/send-row-error-message/send-row-error-message.scss diff --git a/ui/app/components/send_/send-content/send-row-wrapper/send-row-error-message/tests/send-row-error-message-component.test.js b/ui/app/components/send/send-content/send-row-wrapper/send-row-error-message/tests/send-row-error-message-component.test.js similarity index 100% rename from ui/app/components/send_/send-content/send-row-wrapper/send-row-error-message/tests/send-row-error-message-component.test.js rename to ui/app/components/send/send-content/send-row-wrapper/send-row-error-message/tests/send-row-error-message-component.test.js diff --git a/ui/app/components/send_/send-content/send-row-wrapper/send-row-error-message/tests/send-row-error-message-container.test.js b/ui/app/components/send/send-content/send-row-wrapper/send-row-error-message/tests/send-row-error-message-container.test.js similarity index 100% rename from ui/app/components/send_/send-content/send-row-wrapper/send-row-error-message/tests/send-row-error-message-container.test.js rename to ui/app/components/send/send-content/send-row-wrapper/send-row-error-message/tests/send-row-error-message-container.test.js diff --git a/ui/app/components/send_/send-content/send-row-wrapper/send-row-wrapper-README.md b/ui/app/components/send/send-content/send-row-wrapper/send-row-wrapper-README.md similarity index 100% rename from ui/app/components/send_/send-content/send-row-wrapper/send-row-wrapper-README.md rename to ui/app/components/send/send-content/send-row-wrapper/send-row-wrapper-README.md diff --git a/ui/app/components/send_/send-content/send-row-wrapper/send-row-wrapper.component.js b/ui/app/components/send/send-content/send-row-wrapper/send-row-wrapper.component.js similarity index 100% rename from ui/app/components/send_/send-content/send-row-wrapper/send-row-wrapper.component.js rename to ui/app/components/send/send-content/send-row-wrapper/send-row-wrapper.component.js diff --git a/ui/app/components/send_/send-content/send-row-wrapper/send-row-wrapper.scss b/ui/app/components/send/send-content/send-row-wrapper/send-row-wrapper.scss similarity index 100% rename from ui/app/components/send_/send-content/send-row-wrapper/send-row-wrapper.scss rename to ui/app/components/send/send-content/send-row-wrapper/send-row-wrapper.scss diff --git a/ui/app/components/send_/send-content/send-row-wrapper/tests/send-row-wrapper-component.test.js b/ui/app/components/send/send-content/send-row-wrapper/tests/send-row-wrapper-component.test.js similarity index 100% rename from ui/app/components/send_/send-content/send-row-wrapper/tests/send-row-wrapper-component.test.js rename to ui/app/components/send/send-content/send-row-wrapper/tests/send-row-wrapper-component.test.js diff --git a/ui/app/components/send_/send-content/send-to-row/index.js b/ui/app/components/send/send-content/send-to-row/index.js similarity index 100% rename from ui/app/components/send_/send-content/send-to-row/index.js rename to ui/app/components/send/send-content/send-to-row/index.js diff --git a/ui/app/components/send_/send-content/send-to-row/send-to-row-README.md b/ui/app/components/send/send-content/send-to-row/send-to-row-README.md similarity index 100% rename from ui/app/components/send_/send-content/send-to-row/send-to-row-README.md rename to ui/app/components/send/send-content/send-to-row/send-to-row-README.md diff --git a/ui/app/components/send_/send-content/send-to-row/send-to-row.component.js b/ui/app/components/send/send-content/send-to-row/send-to-row.component.js similarity index 100% rename from ui/app/components/send_/send-content/send-to-row/send-to-row.component.js rename to ui/app/components/send/send-content/send-to-row/send-to-row.component.js diff --git a/ui/app/components/send_/send-content/send-to-row/send-to-row.container.js b/ui/app/components/send/send-content/send-to-row/send-to-row.container.js similarity index 100% rename from ui/app/components/send_/send-content/send-to-row/send-to-row.container.js rename to ui/app/components/send/send-content/send-to-row/send-to-row.container.js diff --git a/ui/app/components/send_/send-content/send-to-row/send-to-row.selectors.js b/ui/app/components/send/send-content/send-to-row/send-to-row.selectors.js similarity index 100% rename from ui/app/components/send_/send-content/send-to-row/send-to-row.selectors.js rename to ui/app/components/send/send-content/send-to-row/send-to-row.selectors.js diff --git a/ui/app/components/send_/send-content/send-to-row/send-to-row.utils.js b/ui/app/components/send/send-content/send-to-row/send-to-row.utils.js similarity index 100% rename from ui/app/components/send_/send-content/send-to-row/send-to-row.utils.js rename to ui/app/components/send/send-content/send-to-row/send-to-row.utils.js diff --git a/ui/app/components/send_/send-content/send-to-row/tests/send-to-row-component.test.js b/ui/app/components/send/send-content/send-to-row/tests/send-to-row-component.test.js similarity index 100% rename from ui/app/components/send_/send-content/send-to-row/tests/send-to-row-component.test.js rename to ui/app/components/send/send-content/send-to-row/tests/send-to-row-component.test.js diff --git a/ui/app/components/send_/send-content/send-to-row/tests/send-to-row-container.test.js b/ui/app/components/send/send-content/send-to-row/tests/send-to-row-container.test.js similarity index 100% rename from ui/app/components/send_/send-content/send-to-row/tests/send-to-row-container.test.js rename to ui/app/components/send/send-content/send-to-row/tests/send-to-row-container.test.js diff --git a/ui/app/components/send_/send-content/send-to-row/tests/send-to-row-selectors.test.js b/ui/app/components/send/send-content/send-to-row/tests/send-to-row-selectors.test.js similarity index 100% rename from ui/app/components/send_/send-content/send-to-row/tests/send-to-row-selectors.test.js rename to ui/app/components/send/send-content/send-to-row/tests/send-to-row-selectors.test.js diff --git a/ui/app/components/send_/send-content/send-to-row/tests/send-to-row-utils.test.js b/ui/app/components/send/send-content/send-to-row/tests/send-to-row-utils.test.js similarity index 100% rename from ui/app/components/send_/send-content/send-to-row/tests/send-to-row-utils.test.js rename to ui/app/components/send/send-content/send-to-row/tests/send-to-row-utils.test.js diff --git a/ui/app/components/send_/send-content/tests/send-content-component.test.js b/ui/app/components/send/send-content/tests/send-content-component.test.js similarity index 100% rename from ui/app/components/send_/send-content/tests/send-content-component.test.js rename to ui/app/components/send/send-content/tests/send-content-component.test.js diff --git a/ui/app/components/send_/send-footer/README.md b/ui/app/components/send/send-footer/README.md similarity index 100% rename from ui/app/components/send_/send-footer/README.md rename to ui/app/components/send/send-footer/README.md diff --git a/ui/app/components/send_/send-footer/index.js b/ui/app/components/send/send-footer/index.js similarity index 100% rename from ui/app/components/send_/send-footer/index.js rename to ui/app/components/send/send-footer/index.js diff --git a/ui/app/components/send_/send-footer/send-footer.component.js b/ui/app/components/send/send-footer/send-footer.component.js similarity index 100% rename from ui/app/components/send_/send-footer/send-footer.component.js rename to ui/app/components/send/send-footer/send-footer.component.js diff --git a/ui/app/components/send_/send-footer/send-footer.container.js b/ui/app/components/send/send-footer/send-footer.container.js similarity index 100% rename from ui/app/components/send_/send-footer/send-footer.container.js rename to ui/app/components/send/send-footer/send-footer.container.js diff --git a/ui/app/components/send_/send-footer/send-footer.scss b/ui/app/components/send/send-footer/send-footer.scss similarity index 100% rename from ui/app/components/send_/send-footer/send-footer.scss rename to ui/app/components/send/send-footer/send-footer.scss diff --git a/ui/app/components/send_/send-footer/send-footer.selectors.js b/ui/app/components/send/send-footer/send-footer.selectors.js similarity index 100% rename from ui/app/components/send_/send-footer/send-footer.selectors.js rename to ui/app/components/send/send-footer/send-footer.selectors.js diff --git a/ui/app/components/send_/send-footer/send-footer.utils.js b/ui/app/components/send/send-footer/send-footer.utils.js similarity index 100% rename from ui/app/components/send_/send-footer/send-footer.utils.js rename to ui/app/components/send/send-footer/send-footer.utils.js diff --git a/ui/app/components/send_/send-footer/tests/send-footer-component.test.js b/ui/app/components/send/send-footer/tests/send-footer-component.test.js similarity index 100% rename from ui/app/components/send_/send-footer/tests/send-footer-component.test.js rename to ui/app/components/send/send-footer/tests/send-footer-component.test.js diff --git a/ui/app/components/send_/send-footer/tests/send-footer-container.test.js b/ui/app/components/send/send-footer/tests/send-footer-container.test.js similarity index 100% rename from ui/app/components/send_/send-footer/tests/send-footer-container.test.js rename to ui/app/components/send/send-footer/tests/send-footer-container.test.js diff --git a/ui/app/components/send_/send-footer/tests/send-footer-selectors.test.js b/ui/app/components/send/send-footer/tests/send-footer-selectors.test.js similarity index 100% rename from ui/app/components/send_/send-footer/tests/send-footer-selectors.test.js rename to ui/app/components/send/send-footer/tests/send-footer-selectors.test.js diff --git a/ui/app/components/send_/send-footer/tests/send-footer-utils.test.js b/ui/app/components/send/send-footer/tests/send-footer-utils.test.js similarity index 100% rename from ui/app/components/send_/send-footer/tests/send-footer-utils.test.js rename to ui/app/components/send/send-footer/tests/send-footer-utils.test.js diff --git a/ui/app/components/send_/send-header/README.md b/ui/app/components/send/send-header/README.md similarity index 100% rename from ui/app/components/send_/send-header/README.md rename to ui/app/components/send/send-header/README.md diff --git a/ui/app/components/send_/send-header/index.js b/ui/app/components/send/send-header/index.js similarity index 100% rename from ui/app/components/send_/send-header/index.js rename to ui/app/components/send/send-header/index.js diff --git a/ui/app/components/send_/send-header/send-header.component.js b/ui/app/components/send/send-header/send-header.component.js similarity index 100% rename from ui/app/components/send_/send-header/send-header.component.js rename to ui/app/components/send/send-header/send-header.component.js diff --git a/ui/app/components/send_/send-header/send-header.container.js b/ui/app/components/send/send-header/send-header.container.js similarity index 100% rename from ui/app/components/send_/send-header/send-header.container.js rename to ui/app/components/send/send-header/send-header.container.js diff --git a/ui/app/components/send_/send-header/send-header.selectors.js b/ui/app/components/send/send-header/send-header.selectors.js similarity index 100% rename from ui/app/components/send_/send-header/send-header.selectors.js rename to ui/app/components/send/send-header/send-header.selectors.js diff --git a/ui/app/components/send_/send-header/tests/send-header-component.test.js b/ui/app/components/send/send-header/tests/send-header-component.test.js similarity index 100% rename from ui/app/components/send_/send-header/tests/send-header-component.test.js rename to ui/app/components/send/send-header/tests/send-header-component.test.js diff --git a/ui/app/components/send_/send-header/tests/send-header-container.test.js b/ui/app/components/send/send-header/tests/send-header-container.test.js similarity index 100% rename from ui/app/components/send_/send-header/tests/send-header-container.test.js rename to ui/app/components/send/send-header/tests/send-header-container.test.js diff --git a/ui/app/components/send_/send-header/tests/send-header-selectors.test.js b/ui/app/components/send/send-header/tests/send-header-selectors.test.js similarity index 100% rename from ui/app/components/send_/send-header/tests/send-header-selectors.test.js rename to ui/app/components/send/send-header/tests/send-header-selectors.test.js diff --git a/ui/app/components/send_/send.component.js b/ui/app/components/send/send.component.js similarity index 100% rename from ui/app/components/send_/send.component.js rename to ui/app/components/send/send.component.js diff --git a/ui/app/components/send_/send.constants.js b/ui/app/components/send/send.constants.js similarity index 100% rename from ui/app/components/send_/send.constants.js rename to ui/app/components/send/send.constants.js diff --git a/ui/app/components/send_/send.container.js b/ui/app/components/send/send.container.js similarity index 100% rename from ui/app/components/send_/send.container.js rename to ui/app/components/send/send.container.js diff --git a/ui/app/components/send_/send.scss b/ui/app/components/send/send.scss similarity index 100% rename from ui/app/components/send_/send.scss rename to ui/app/components/send/send.scss diff --git a/ui/app/components/send_/send.selectors.js b/ui/app/components/send/send.selectors.js similarity index 100% rename from ui/app/components/send_/send.selectors.js rename to ui/app/components/send/send.selectors.js diff --git a/ui/app/components/send_/send.utils.js b/ui/app/components/send/send.utils.js similarity index 100% rename from ui/app/components/send_/send.utils.js rename to ui/app/components/send/send.utils.js diff --git a/ui/app/components/send_/tests/send-component.test.js b/ui/app/components/send/tests/send-component.test.js similarity index 100% rename from ui/app/components/send_/tests/send-component.test.js rename to ui/app/components/send/tests/send-component.test.js diff --git a/ui/app/components/send_/tests/send-container.test.js b/ui/app/components/send/tests/send-container.test.js similarity index 100% rename from ui/app/components/send_/tests/send-container.test.js rename to ui/app/components/send/tests/send-container.test.js diff --git a/ui/app/components/send_/tests/send-selectors-test-data.js b/ui/app/components/send/tests/send-selectors-test-data.js similarity index 100% rename from ui/app/components/send_/tests/send-selectors-test-data.js rename to ui/app/components/send/tests/send-selectors-test-data.js diff --git a/ui/app/components/send_/tests/send-selectors.test.js b/ui/app/components/send/tests/send-selectors.test.js similarity index 100% rename from ui/app/components/send_/tests/send-selectors.test.js rename to ui/app/components/send/tests/send-selectors.test.js diff --git a/ui/app/components/send_/tests/send-utils.test.js b/ui/app/components/send/tests/send-utils.test.js similarity index 100% rename from ui/app/components/send_/tests/send-utils.test.js rename to ui/app/components/send/tests/send-utils.test.js diff --git a/ui/app/components/send/to-autocomplete/index.js b/ui/app/components/send/to-autocomplete/index.js new file mode 100644 index 000000000..afa2eb5a4 --- /dev/null +++ b/ui/app/components/send/to-autocomplete/index.js @@ -0,0 +1 @@ +export { default } from './to-autocomplete.js' \ No newline at end of file diff --git a/ui/app/components/send/to-autocomplete/to-autocomplete.js b/ui/app/components/send/to-autocomplete/to-autocomplete.js new file mode 100644 index 000000000..80cfa7a85 --- /dev/null +++ b/ui/app/components/send/to-autocomplete/to-autocomplete.js @@ -0,0 +1,120 @@ +const Component = require('react').Component +const PropTypes = require('prop-types') +const h = require('react-hyperscript') +const inherits = require('util').inherits +const AccountListItem = require('../account-list-item/account-list-item.component').default +const connect = require('react-redux').connect + +ToAutoComplete.contextTypes = { + t: PropTypes.func, +} + +module.exports = connect()(ToAutoComplete) + + +inherits(ToAutoComplete, Component) +function ToAutoComplete () { + Component.call(this) + + this.state = { accountsToRender: [] } +} + +ToAutoComplete.prototype.getListItemIcon = function (listItemAddress, toAddress) { + const listItemIcon = h(`i.fa.fa-check.fa-lg`, { style: { color: '#02c9b1' } }) + + return toAddress && listItemAddress === toAddress + ? listItemIcon + : null +} + +ToAutoComplete.prototype.renderDropdown = function () { + const { + closeDropdown, + onChange, + to, + } = this.props + const { accountsToRender } = this.state + + return accountsToRender.length && h('div', {}, [ + + h('div.send-v2__from-dropdown__close-area', { + onClick: closeDropdown, + }), + + h('div.send-v2__from-dropdown__list', {}, [ + + ...accountsToRender.map(account => h(AccountListItem, { + account, + className: 'account-list-item__dropdown', + handleClick: () => { + onChange(account.address) + closeDropdown() + }, + icon: this.getListItemIcon(account.address, to), + displayBalance: false, + displayAddress: true, + })), + + ]), + + ]) +} + +ToAutoComplete.prototype.handleInputEvent = function (event = {}, cb) { + const { + to, + accounts, + closeDropdown, + openDropdown, + } = this.props + + const matchingAccounts = accounts.filter(({ address }) => address.match(to || '')) + const matches = matchingAccounts.length + + if (!matches || matchingAccounts[0].address === to) { + this.setState({ accountsToRender: [] }) + event.target && event.target.select() + closeDropdown() + } else { + this.setState({ accountsToRender: matchingAccounts }) + openDropdown() + } + cb && cb(event.target.value) +} + +ToAutoComplete.prototype.componentDidUpdate = function (nextProps, nextState) { + if (this.props.to !== nextProps.to) { + this.handleInputEvent() + } +} + +ToAutoComplete.prototype.render = function () { + const { + to, + dropdownOpen, + onChange, + inError, + } = this.props + + return h('div.send-v2__to-autocomplete', {}, [ + + h('input.send-v2__to-autocomplete__input', { + placeholder: this.context.t('recipientAddress'), + className: inError ? `send-v2__error-border` : '', + value: to, + onChange: event => onChange(event.target.value), + onFocus: event => this.handleInputEvent(event), + style: { + borderColor: inError ? 'red' : null, + }, + }), + + !to && h(`i.fa.fa-caret-down.fa-lg.send-v2__to-autocomplete__down-caret`, { + style: { color: '#dedede' }, + onClick: () => this.handleInputEvent(), + }), + + dropdownOpen && this.renderDropdown(), + + ]) +}