|
|
@ -4,7 +4,7 @@ import SendRowWrapper from '../send-row-wrapper'; |
|
|
|
import Identicon from '../../../../components/ui/identicon/identicon.component'; |
|
|
|
import Identicon from '../../../../components/ui/identicon/identicon.component'; |
|
|
|
import TokenBalance from '../../../../components/ui/token-balance'; |
|
|
|
import TokenBalance from '../../../../components/ui/token-balance'; |
|
|
|
import UserPreferencedCurrencyDisplay from '../../../../components/app/user-preferenced-currency-display'; |
|
|
|
import UserPreferencedCurrencyDisplay from '../../../../components/app/user-preferenced-currency-display'; |
|
|
|
import { PRIMARY } from '../../../../helpers/constants/common'; |
|
|
|
import { ERC20, ETH, PRIMARY } from '../../../../helpers/constants/common'; |
|
|
|
|
|
|
|
|
|
|
|
export default class SendAssetRow extends Component { |
|
|
|
export default class SendAssetRow extends Component { |
|
|
|
static propTypes = { |
|
|
|
static propTypes = { |
|
|
@ -19,6 +19,7 @@ export default class SendAssetRow extends Component { |
|
|
|
selectedAddress: PropTypes.string.isRequired, |
|
|
|
selectedAddress: PropTypes.string.isRequired, |
|
|
|
sendTokenAddress: PropTypes.string, |
|
|
|
sendTokenAddress: PropTypes.string, |
|
|
|
setSendToken: PropTypes.func.isRequired, |
|
|
|
setSendToken: PropTypes.func.isRequired, |
|
|
|
|
|
|
|
nativeCurrency: PropTypes.string, |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
static contextTypes = { |
|
|
|
static contextTypes = { |
|
|
@ -47,7 +48,7 @@ export default class SendAssetRow extends Component { |
|
|
|
name: 'User clicks "Assets" dropdown', |
|
|
|
name: 'User clicks "Assets" dropdown', |
|
|
|
}, |
|
|
|
}, |
|
|
|
customVariables: { |
|
|
|
customVariables: { |
|
|
|
assetSelected: token ? 'ERC20' : 'ETH', |
|
|
|
assetSelected: token ? ERC20 : this.props.nativeCurrency, |
|
|
|
}, |
|
|
|
}, |
|
|
|
}); |
|
|
|
}); |
|
|
|
this.props.setSendToken(token); |
|
|
|
this.props.setSendToken(token); |
|
|
@ -78,7 +79,7 @@ export default class SendAssetRow extends Component { |
|
|
|
className="send-v2__asset-dropdown__input-wrapper" |
|
|
|
className="send-v2__asset-dropdown__input-wrapper" |
|
|
|
onClick={this.openDropdown} |
|
|
|
onClick={this.openDropdown} |
|
|
|
> |
|
|
|
> |
|
|
|
{token ? this.renderAsset(token) : this.renderEth()} |
|
|
|
{token ? this.renderAsset(token) : this.renderNativeCurrency()} |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
); |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
@ -92,7 +93,7 @@ export default class SendAssetRow extends Component { |
|
|
|
onClick={this.closeDropdown} |
|
|
|
onClick={this.closeDropdown} |
|
|
|
/> |
|
|
|
/> |
|
|
|
<div className="send-v2__asset-dropdown__list"> |
|
|
|
<div className="send-v2__asset-dropdown__list"> |
|
|
|
{this.renderEth(true)} |
|
|
|
{this.renderNativeCurrency(true)} |
|
|
|
{this.props.tokens.map((token) => this.renderAsset(token, true))} |
|
|
|
{this.props.tokens.map((token) => this.renderAsset(token, true))} |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
@ -100,9 +101,9 @@ export default class SendAssetRow extends Component { |
|
|
|
); |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
renderEth(insideDropdown = false) { |
|
|
|
renderNativeCurrency(insideDropdown = false) { |
|
|
|
const { t } = this.context; |
|
|
|
const { t } = this.context; |
|
|
|
const { accounts, selectedAddress } = this.props; |
|
|
|
const { accounts, selectedAddress, nativeCurrency } = this.props; |
|
|
|
|
|
|
|
|
|
|
|
const balanceValue = accounts[selectedAddress] |
|
|
|
const balanceValue = accounts[selectedAddress] |
|
|
|
? accounts[selectedAddress].balance |
|
|
|
? accounts[selectedAddress].balance |
|
|
@ -118,10 +119,15 @@ export default class SendAssetRow extends Component { |
|
|
|
onClick={() => this.selectToken()} |
|
|
|
onClick={() => this.selectToken()} |
|
|
|
> |
|
|
|
> |
|
|
|
<div className="send-v2__asset-dropdown__asset-icon"> |
|
|
|
<div className="send-v2__asset-dropdown__asset-icon"> |
|
|
|
<Identicon diameter={36} /> |
|
|
|
<Identicon |
|
|
|
|
|
|
|
diameter={36} |
|
|
|
|
|
|
|
address={nativeCurrency === ETH ? undefined : nativeCurrency} |
|
|
|
|
|
|
|
/> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div className="send-v2__asset-dropdown__asset-data"> |
|
|
|
<div className="send-v2__asset-dropdown__asset-data"> |
|
|
|
<div className="send-v2__asset-dropdown__symbol">ETH</div> |
|
|
|
<div className="send-v2__asset-dropdown__symbol"> |
|
|
|
|
|
|
|
{nativeCurrency} |
|
|
|
|
|
|
|
</div> |
|
|
|
<div className="send-v2__asset-dropdown__name"> |
|
|
|
<div className="send-v2__asset-dropdown__name"> |
|
|
|
<span className="send-v2__asset-dropdown__name__label"> |
|
|
|
<span className="send-v2__asset-dropdown__name__label"> |
|
|
|
{`${t('balance')}:`} |
|
|
|
{`${t('balance')}:`} |
|
|
|