Show recipient alias in confirm header if exists (#6944)

feature/default_network_editable
Kristian Tapia 5 years ago committed by Whymarrh Whitby
parent 24e3970881
commit d4db2c3de3
  1. 3
      ui/app/components/app/confirm-page-container/confirm-page-container.component.js
  2. 5
      ui/app/components/ui/sender-to-recipient/sender-to-recipient.component.js
  3. 4
      ui/app/pages/confirm-transaction-base/confirm-transaction-base.component.js
  4. 4
      ui/app/pages/confirm-transaction-base/confirm-transaction-base.container.js
  5. 1
      ui/app/pages/send/send-footer/tests/send-footer-container.test.js

@ -24,6 +24,7 @@ export default class ConfirmPageContainer extends Component {
fromName: PropTypes.string, fromName: PropTypes.string,
toAddress: PropTypes.string, toAddress: PropTypes.string,
toName: PropTypes.string, toName: PropTypes.string,
toNickname: PropTypes.string,
// Content // Content
contentComponent: PropTypes.node, contentComponent: PropTypes.node,
errorKey: PropTypes.string, errorKey: PropTypes.string,
@ -68,6 +69,7 @@ export default class ConfirmPageContainer extends Component {
fromName, fromName,
fromAddress, fromAddress,
toName, toName,
toNickname,
toAddress, toAddress,
disabled, disabled,
errorKey, errorKey,
@ -126,6 +128,7 @@ export default class ConfirmPageContainer extends Component {
senderAddress={fromAddress} senderAddress={fromAddress}
recipientName={toName} recipientName={toName}
recipientAddress={toAddress} recipientAddress={toAddress}
recipientNickname={toNickname}
assetImage={renderAssetImage ? assetImage : undefined} assetImage={renderAssetImage ? assetImage : undefined}
/> />
</ConfirmPageContainerHeader> </ConfirmPageContainerHeader>

@ -19,6 +19,7 @@ export default class SenderToRecipient extends PureComponent {
senderAddress: PropTypes.string, senderAddress: PropTypes.string,
recipientName: PropTypes.string, recipientName: PropTypes.string,
recipientAddress: PropTypes.string, recipientAddress: PropTypes.string,
recipientNickname: PropTypes.string,
t: PropTypes.func, t: PropTypes.func,
variant: PropTypes.oneOf([DEFAULT_VARIANT, CARDS_VARIANT, FLAT_VARIANT]), variant: PropTypes.oneOf([DEFAULT_VARIANT, CARDS_VARIANT, FLAT_VARIANT]),
addressOnly: PropTypes.bool, addressOnly: PropTypes.bool,
@ -88,7 +89,7 @@ export default class SenderToRecipient extends PureComponent {
renderRecipientWithAddress () { renderRecipientWithAddress () {
const { t } = this.context const { t } = this.context
const { recipientName, recipientAddress, addressOnly, onRecipientClick } = this.props const { recipientName, recipientAddress, recipientNickname, addressOnly, onRecipientClick } = this.props
const checksummedRecipientAddress = checksumAddress(recipientAddress) const checksummedRecipientAddress = checksumAddress(recipientAddress)
return ( return (
@ -114,7 +115,7 @@ export default class SenderToRecipient extends PureComponent {
{ {
addressOnly addressOnly
? `${t('to')}: ${checksummedRecipientAddress}` ? `${t('to')}: ${checksummedRecipientAddress}`
: (recipientName || this.context.t('newContract')) : (recipientNickname || recipientName || this.context.t('newContract'))
} }
</div> </div>
</Tooltip> </Tooltip>

@ -59,6 +59,7 @@ export default class ConfirmTransactionBase extends Component {
tokenData: PropTypes.object, tokenData: PropTypes.object,
tokenProps: PropTypes.object, tokenProps: PropTypes.object,
toName: PropTypes.string, toName: PropTypes.string,
toNickname: PropTypes.string,
transactionStatus: PropTypes.string, transactionStatus: PropTypes.string,
txData: PropTypes.object, txData: PropTypes.object,
unapprovedTxCount: PropTypes.number, unapprovedTxCount: PropTypes.number,
@ -529,6 +530,7 @@ export default class ConfirmTransactionBase extends Component {
fromAddress, fromAddress,
toName, toName,
toAddress, toAddress,
toNickname,
methodData, methodData,
valid: propsValid = true, valid: propsValid = true,
errorMessage, errorMessage,
@ -551,13 +553,13 @@ export default class ConfirmTransactionBase extends Component {
const { name } = methodData const { name } = methodData
const { valid, errorKey } = this.getErrorKey() const { valid, errorKey } = this.getErrorKey()
const { totalTx, positionOfCurrentTx, nextTxId, prevTxId, showNavigation, firstTx, lastTx, ofText, requestsWaitingText } = this.getNavigateTxData() const { totalTx, positionOfCurrentTx, nextTxId, prevTxId, showNavigation, firstTx, lastTx, ofText, requestsWaitingText } = this.getNavigateTxData()
return ( return (
<ConfirmPageContainer <ConfirmPageContainer
fromName={fromName} fromName={fromName}
fromAddress={fromAddress} fromAddress={fromAddress}
toName={toName} toName={toName}
toAddress={toAddress} toAddress={toAddress}
toNickname={toNickname}
showEdit={onEdit && !isTxReprice} showEdit={onEdit && !isTxReprice}
// In the event that the key is falsy (and inherently invalid), use a fallback string // In the event that the key is falsy (and inherently invalid), use a fallback string
action={getMethodName(name) || this.context.tOrKey(transactionCategory) || this.context.t('contractInteraction')} action={getMethodName(name) || this.context.tOrKey(transactionCategory) || this.context.t('contractInteraction')}

@ -37,6 +37,7 @@ const mapStateToProps = (state, ownProps) => {
const { const {
conversionRate, conversionRate,
identities, identities,
addressBook,
currentCurrency, currentCurrency,
selectedAddress, selectedAddress,
selectedAddressTxList, selectedAddressTxList,
@ -75,6 +76,8 @@ const mapStateToProps = (state, ownProps) => {
: addressSlicer(checksumAddress(toAddress)) : addressSlicer(checksumAddress(toAddress))
) )
const addressBookObject = addressBook[checksumAddress(toAddress)]
const toNickname = addressBookObject ? addressBookObject.name : ''
const isTxReprice = Boolean(lastGasPrice) const isTxReprice = Boolean(lastGasPrice)
const transactionStatus = transaction ? transaction.status : '' const transactionStatus = transaction ? transaction.status : ''
@ -115,6 +118,7 @@ const mapStateToProps = (state, ownProps) => {
fromName, fromName,
toAddress, toAddress,
toName, toName,
toNickname,
ethTransactionAmount, ethTransactionAmount,
ethTransactionFee, ethTransactionFee,
ethTransactionTotal, ethTransactionTotal,

@ -38,6 +38,7 @@ proxyquire('../send-footer.container.js', {
getSendEditingTransactionId: (s) => `mockEditingTransactionId:${s}`, getSendEditingTransactionId: (s) => `mockEditingTransactionId:${s}`,
getSendFromObject: (s) => `mockFromObject:${s}`, getSendFromObject: (s) => `mockFromObject:${s}`,
getSendTo: (s) => `mockTo:${s}`, getSendTo: (s) => `mockTo:${s}`,
getSendToNickname: (s) => `mockToNickname:${s}`,
getSendToAccounts: (s) => `mockToAccounts:${s}`, getSendToAccounts: (s) => `mockToAccounts:${s}`,
getTokenBalance: (s) => `mockTokenBalance:${s}`, getTokenBalance: (s) => `mockTokenBalance:${s}`,
getSendHexData: (s) => `mockHexData:${s}`, getSendHexData: (s) => `mockHexData:${s}`,

Loading…
Cancel
Save