Skip to content

Commit

Permalink
Merge 3f36f90 into 09eac14
Browse files Browse the repository at this point in the history
  • Loading branch information
walmat authored Sep 19, 2024
2 parents 09eac14 + 3f36f90 commit 26b15d9
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/components/fields/CheckboxField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export default function CheckboxField({
</Box>
<Box flexShrink={1}>
<AccentColorProvider color={customColor || action}>
<Text color={isChecked ? 'accent' : 'secondary80 (Deprecated)'} size="16px / 22px (Deprecated)" weight="bold">
<Text color={isChecked ? 'accent' : 'secondary80 (Deprecated)'} size="15pt" weight="bold">
{label}
</Text>
</AccentColorProvider>
Expand Down
22 changes: 15 additions & 7 deletions src/components/send/SendHeader.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,17 +117,15 @@ export default function SendHeader({
const isPreExistingContact = (contact?.nickname?.length || 0) > 0;

const name =
removeFirstEmojiFromString(userWallet?.label || contact?.nickname || nickname) || userWallet?.ens || contact?.ens || recipient;
removeFirstEmojiFromString(contact?.nickname || userWallet?.label || nickname) || userWallet?.ens || contact?.ens || recipient;

const handleNavigateToContact = useCallback(() => {
let nickname = profilesEnabled ? (!isHexString(recipient) ? recipient : null) : recipient;
let color = '';
const nickname = !isHexString(name) ? name : '';
if (!profilesEnabled) {
color = contact?.color;
if (color !== 0 && !color) {
const emoji = profileUtils.addressHashedEmoji(hexAddress);
color = profileUtils.addressHashedColorIndex(hexAddress) || 0;
nickname = isHexString(recipient) ? emoji : `${emoji} ${recipient}`;
}
}

Expand All @@ -142,7 +140,7 @@ export default function SendHeader({
onRefocusInput,
type: 'contact_profile',
});
}, [contact, hexAddress, navigate, onRefocusInput, profilesEnabled, recipient]);
}, [contact, hexAddress, name, navigate, onRefocusInput, profilesEnabled, recipient]);

const handleOpenContactActionSheet = useCallback(async () => {
return showActionSheetWithOptions(
Expand All @@ -162,7 +160,7 @@ export default function SendHeader({
address: hexAddress,
nickname: name,
onDelete: () => {
onChangeAddressInput(contact?.ens);
onChangeAddressInput(contact?.ens ? contact?.ens : contact?.address);
},
removeContact: removeContact,
});
Expand All @@ -175,7 +173,17 @@ export default function SendHeader({
}
}
);
}, [contact?.ens, handleNavigateToContact, hexAddress, onRefocusInput, removeContact, setClipboard, name, onChangeAddressInput]);
}, [
hexAddress,
name,
removeContact,
onChangeAddressInput,
contact?.ens,
contact?.address,
handleNavigateToContact,
onRefocusInput,
setClipboard,
]);

const onChange = useCallback(
text => {
Expand Down
18 changes: 13 additions & 5 deletions src/screens/SendSheet.js
Original file line number Diff line number Diff line change
Expand Up @@ -588,7 +588,7 @@ export default function SendSheet(props) {
})();
}
},
[amountDetails.assetAmount, goBack, isENS, isHardwareWallet, navigate, onSubmit, recipient, selected?.name, selected?.network]
[amountDetails, goBack, isENS, isHardwareWallet, navigate, onSubmit, recipient, selected?.name, selected?.network]
);

const { buttonDisabled, buttonLabel } = useMemo(() => {
Expand Down Expand Up @@ -713,8 +713,11 @@ export default function SendSheet(props) {
const isValid = checkIsValidAddressOrDomainFormat(text);
if (!isValid) {
setIsValidAddress();
setToAddress();
} else {
setToAddress(text);
setIsValidAddress(true);
}
setToAddress();
setCurrentInput(text);
setRecipient(text);
setNickname(text);
Expand Down Expand Up @@ -764,7 +767,6 @@ export default function SendSheet(props) {

if (
!!accountAddress &&
amountDetails.assetAmount !== '' &&
Object.entries(selected).length &&
assetChainId === currentChainId &&
currentProviderChainId === currentChainId &&
Expand Down Expand Up @@ -813,6 +815,12 @@ export default function SendSheet(props) {

const isEmptyWallet = !sortedAssets?.length && !sendableUniqueTokens?.length;

const filteredUserAccountsFromContacts = useMemo(() => {
return userAccounts.filter(
account => !filteredContacts.some(contact => contact.address.toLowerCase() === account.address.toLowerCase())
);
}, [userAccounts, filteredContacts]);

return (
<Container testID="send-sheet">
<SheetContainer>
Expand All @@ -832,7 +840,7 @@ export default function SendSheet(props) {
recipientFieldRef={recipientFieldRef}
removeContact={onRemoveContact}
showAssetList={showAssetList}
userAccounts={userAccounts}
userAccounts={filteredUserAccountsFromContacts}
watchedAccounts={watchedAccounts}
/>
{showEmptyState && (
Expand All @@ -848,7 +856,7 @@ export default function SendSheet(props) {
setNickname(nickname);
}}
removeContact={onRemoveContact}
userAccounts={userAccounts}
userAccounts={filteredUserAccountsFromContacts}
watchedAccounts={watchedAccounts}
/>
)}
Expand Down

0 comments on commit 26b15d9

Please sign in to comment.