diff --git a/src/app/components/AddressContainer/index.tsx b/src/app/components/AddressContainer/index.tsx index 89d8c96ca..a65fdd6c5 100644 --- a/src/app/components/AddressContainer/index.tsx +++ b/src/app/components/AddressContainer/index.tsx @@ -53,10 +53,10 @@ const defaultPCSuffixAddressSize = const defaultPCSuffixPosAddressSize = 10; const defaultMobileSuffixAddressSize = 4; -const getAddressLabelInfo = (label, alias) => { +const getAddressLabelInfo = label => { if (label) { return { - label: `${label}${alias ? ` (${alias})` : ''}`, + label, icon: ( { }; } return { - label: alias, + label: '', icon: null, }; }; @@ -94,10 +94,11 @@ const RenderAddress = ({ prefix = null, suffix = null, type = 'pow', + addressLabel = '', }: any) => { const aftercontent = type === 'pow' - ? cfxAddress && !isFull && !alias + ? cfxAddress && !isFull && !addressLabel && !alias ? cfxAddress.substr(-suffixSize) : '' : ''; @@ -129,7 +130,7 @@ const RenderAddress = ({ alias={alias} aftercontent={aftercontent} > - {content || alias || cfxAddress} + {content || addressLabel || alias || cfxAddress} ); } @@ -141,7 +142,7 @@ const RenderAddress = ({ alias={alias} aftercontent={aftercontent} > - {content || alias || cfxAddress} + {content || addressLabel || alias || cfxAddress} ); } @@ -149,7 +150,34 @@ const RenderAddress = ({ return ( {prefix} - + + {addressLabel ? ( + <> + + + {t => t(translations.profile.address.myNameTag)} + + + {addressLabel} + + ) : null} +
{hoverValue || cfxAddress}
+ {addressLabel && alias ? ( + <> + + + {t => t(translations.profile.address.publicNameTag)} + + + {alias} + + ) : null} + + } + > {text}
{suffix} @@ -199,7 +227,6 @@ export const AddressContainer = withTranslation()( globalData[LOCALSTORAGE_KEYS_MAP.addressLabel][ formatAddress(contractCreated) ], - alias || txtContractCreation, ); addressLabel = label; @@ -208,7 +235,8 @@ export const AddressContainer = withTranslation()( return RenderAddress({ cfxAddress: '', - alias: addressLabel, + alias: alias || txtContractCreation, + addressLabel, hoverValue: formatAddress(contractCreated), hrefAddress: formatAddress(contractCreated), link, @@ -311,7 +339,6 @@ export const AddressContainer = withTranslation()( globalData[LOCALSTORAGE_KEYS_MAP.addressLabel][ formatAddress(cfxAddress) ], - alias, ); addressLabel = label; @@ -328,7 +355,8 @@ export const AddressContainer = withTranslation()( ); return RenderAddress({ cfxAddress, - alias: addressLabel, + alias, + addressLabel, link, isFull, maxWidth, @@ -362,7 +390,8 @@ export const AddressContainer = withTranslation()( if (isMe) { return RenderAddress({ cfxAddress, - alias: addressLabel, + alias, + addressLabel, link, isFull, maxWidth, @@ -385,7 +414,8 @@ export const AddressContainer = withTranslation()( return RenderAddress({ cfxAddress, - alias: addressLabel, + alias, + addressLabel, link, isFull, maxWidth, @@ -539,7 +569,7 @@ const addressStyle = (props: any) => ` display: inline-flex !important; flex-wrap: nowrap; max-width: ${ - props.maxwidth || (props.alias ? 180 : defaultPCMaxWidth) + props.maxwidth || (props.alias ? 160 : defaultPCMaxWidth) }px !important; outline: none; @@ -552,7 +582,7 @@ const addressStyle = (props: any) => ` ${media.m} { max-width: ${ - props.maxwidth || (props.alias ? 160 : defaultMobileMaxWidth) + props.maxwidth || (props.alias ? 140 : defaultMobileMaxWidth) }px !important; } diff --git a/src/app/containers/Transaction/EventLogs/Address.tsx b/src/app/containers/Transaction/EventLogs/Address.tsx index 04f9d8ca0..11e52c286 100644 --- a/src/app/containers/Transaction/EventLogs/Address.tsx +++ b/src/app/containers/Transaction/EventLogs/Address.tsx @@ -2,14 +2,12 @@ import React from 'react'; import { Link } from 'app/components/Link/Loadable'; import { formatAddress } from 'utils'; import { ContractDetail } from 'app/components/TxnComponents/ContractDetail'; -import { AddressLabel } from 'app/components/TxnComponents/AddressLabel'; export const Address = ({ address, contract }) => { return ( <> {formatAddress(address)} - ); }; diff --git a/src/locales/en/translation.json b/src/locales/en/translation.json index 2e9663f60..5a6addf02 100644 --- a/src/locales/en/translation.json +++ b/src/locales/en/translation.json @@ -34,7 +34,9 @@ "label": "Please input name tags", "duplicated": "Duplicated address, already in the name tags list", "duplicatedNameTag": "Duplicated name tag, already in the name tags list" - } + }, + "publicNameTag": "Public Tag: ", + "myNameTag": "My Name Tag: " } }, "metadata": { diff --git a/src/locales/zh_cn/translation.json b/src/locales/zh_cn/translation.json index 17a7c38c5..7f41caec1 100644 --- a/src/locales/zh_cn/translation.json +++ b/src/locales/zh_cn/translation.json @@ -34,7 +34,9 @@ "label": "请输入标签", "duplicated": "重复的地址,已经存在于记录中", "duplicatedNameTag": "重复的标签,已经存在于记录中" - } + }, + "publicNameTag": "公共标签:", + "myNameTag": "我的标签:" } }, "metadata": {