|
|
|
@ -103,34 +103,69 @@ export function RecipientWithAddress({ |
|
|
|
|
recipientNickname, |
|
|
|
|
recipientEns, |
|
|
|
|
recipientName, |
|
|
|
|
recipientMetadataName, |
|
|
|
|
}) { |
|
|
|
|
const t = useI18nContext(); |
|
|
|
|
const [showNicknamePopovers, setShowNicknamePopovers] = useState(false); |
|
|
|
|
const [addressCopied, setAddressCopied] = useState(false); |
|
|
|
|
|
|
|
|
|
let tooltipHtml = <p>{t('copiedExclamation')}</p>; |
|
|
|
|
if (!addressCopied) { |
|
|
|
|
tooltipHtml = addressOnly ? ( |
|
|
|
|
<p>{t('copyAddress')}</p> |
|
|
|
|
) : ( |
|
|
|
|
<p> |
|
|
|
|
{shortenAddress(checksummedRecipientAddress)} |
|
|
|
|
<br /> |
|
|
|
|
{t('copyAddress')} |
|
|
|
|
</p> |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return ( |
|
|
|
|
<> |
|
|
|
|
<div |
|
|
|
|
className="sender-to-recipient__party sender-to-recipient__party--recipient sender-to-recipient__party--recipient-with-address" |
|
|
|
|
onClick={() => { |
|
|
|
|
setShowNicknamePopovers(true); |
|
|
|
|
if (onRecipientClick) { |
|
|
|
|
onRecipientClick(); |
|
|
|
|
if (recipientName) { |
|
|
|
|
setAddressCopied(true); |
|
|
|
|
copyToClipboard(checksummedRecipientAddress); |
|
|
|
|
} else { |
|
|
|
|
setShowNicknamePopovers(true); |
|
|
|
|
if (onRecipientClick) { |
|
|
|
|
onRecipientClick(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}} |
|
|
|
|
> |
|
|
|
|
<div className="sender-to-recipient__sender-icon"> |
|
|
|
|
<Identicon address={checksummedRecipientAddress} diameter={24} /> |
|
|
|
|
</div> |
|
|
|
|
<div className="sender-to-recipient__name"> |
|
|
|
|
{addressOnly |
|
|
|
|
? recipientNickname || |
|
|
|
|
recipientEns || |
|
|
|
|
shortenAddress(checksummedRecipientAddress) |
|
|
|
|
: recipientNickname || |
|
|
|
|
recipientEns || |
|
|
|
|
recipientName || |
|
|
|
|
t('newContract')} |
|
|
|
|
</div> |
|
|
|
|
<Tooltip |
|
|
|
|
position="bottom" |
|
|
|
|
disabled={!recipientName} |
|
|
|
|
html={tooltipHtml} |
|
|
|
|
wrapperClassName="sender-to-recipient__tooltip-wrapper" |
|
|
|
|
containerClassName="sender-to-recipient__tooltip-container" |
|
|
|
|
onHidden={() => setAddressCopied(false)} |
|
|
|
|
> |
|
|
|
|
<div |
|
|
|
|
className="sender-to-recipient__name" |
|
|
|
|
data-testid="sender-to-recipient__name" |
|
|
|
|
> |
|
|
|
|
{addressOnly |
|
|
|
|
? recipientName || |
|
|
|
|
recipientNickname || |
|
|
|
|
recipientMetadataName || |
|
|
|
|
recipientEns || |
|
|
|
|
shortenAddress(checksummedRecipientAddress) |
|
|
|
|
: recipientName || |
|
|
|
|
recipientNickname || |
|
|
|
|
recipientMetadataName || |
|
|
|
|
recipientEns || |
|
|
|
|
t('newContract')} |
|
|
|
|
</div> |
|
|
|
|
</Tooltip> |
|
|
|
|
</div> |
|
|
|
|
{showNicknamePopovers ? ( |
|
|
|
|
<NicknamePopovers |
|
|
|
@ -145,6 +180,7 @@ export function RecipientWithAddress({ |
|
|
|
|
RecipientWithAddress.propTypes = { |
|
|
|
|
checksummedRecipientAddress: PropTypes.string, |
|
|
|
|
recipientName: PropTypes.string, |
|
|
|
|
recipientMetadataName: PropTypes.string, |
|
|
|
|
recipientEns: PropTypes.string, |
|
|
|
|
recipientNickname: PropTypes.string, |
|
|
|
|
addressOnly: PropTypes.bool, |
|
|
|
@ -175,6 +211,7 @@ export default function SenderToRecipient({ |
|
|
|
|
senderName, |
|
|
|
|
recipientNickname, |
|
|
|
|
recipientName, |
|
|
|
|
recipientMetadataName, |
|
|
|
|
recipientEns, |
|
|
|
|
onRecipientClick, |
|
|
|
|
onSenderClick, |
|
|
|
@ -208,6 +245,7 @@ export default function SenderToRecipient({ |
|
|
|
|
recipientNickname={recipientNickname} |
|
|
|
|
recipientEns={recipientEns} |
|
|
|
|
recipientName={recipientName} |
|
|
|
|
recipientMetadataName={recipientMetadataName} |
|
|
|
|
/> |
|
|
|
|
) : ( |
|
|
|
|
<div className="sender-to-recipient__party sender-to-recipient__party--recipient"> |
|
|
|
@ -228,6 +266,7 @@ SenderToRecipient.propTypes = { |
|
|
|
|
senderName: PropTypes.string, |
|
|
|
|
senderAddress: PropTypes.string, |
|
|
|
|
recipientName: PropTypes.string, |
|
|
|
|
recipientMetadataName: PropTypes.string, |
|
|
|
|
recipientEns: PropTypes.string, |
|
|
|
|
recipientAddress: PropTypes.string, |
|
|
|
|
recipientNickname: PropTypes.string, |
|
|
|
|