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