Skip to content

Commit

Permalink
fix(ui-ux): display chevron if entrypoint is settings (#4067)
Browse files Browse the repository at this point in the history
  • Loading branch information
Pierre Gee authored Oct 17, 2023
1 parent 6294617 commit 4266a32
Showing 1 changed file with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export function AddressBookScreen({ route, navigation }: Props): JSX.Element {
const dispatch = useAppDispatch();
const logger = useLogger();
// condition to hide icon if not from send page
const enableAddressSelect =
const isAddressSelectDisabled =
selectedAddress !== undefined && onAddressSelect !== undefined;
const userPreferencesFromStore = useSelector(
(state: RootState) => state.userPreferences,
Expand Down Expand Up @@ -233,13 +233,13 @@ export function AddressBookScreen({ route, navigation }: Props): JSX.Element {
})
.sort((curr, next) => {
if (
enableAddressSelect &&
isAddressSelectDisabled &&
curr.addressDomainType === addressDomainType
) {
return -1;
}
if (
enableAddressSelect &&
isAddressSelectDisabled &&
next.addressDomainType === addressDomainType
) {
return 1;
Expand Down Expand Up @@ -308,7 +308,7 @@ export function AddressBookScreen({ route, navigation }: Props): JSX.Element {
}): JSX.Element => {
const { item, index, testIDSuffix } = props;
const isDisabledToSelect =
enableAddressSelect &&
isAddressSelectDisabled &&
activeButtonGroup === ButtonGroupTabKey.Whitelisted &&
(item as WhitelistedAddress).addressDomainType === addressDomainType &&
addressDomainType === DomainType.EVM; // disable address selection if its from the same EVM domain
Expand Down Expand Up @@ -365,7 +365,7 @@ export function AddressBookScreen({ route, navigation }: Props): JSX.Element {
await onFavouriteAddress(item as WhitelistedAddress)
}
testID={`address_row_star_${index}_${testIDSuffix}`}
disabled={enableAddressSelect}
disabled={isAddressSelectDisabled}
>
{item.isFavourite ? (
<FavoriteCheckIcon
Expand Down Expand Up @@ -399,7 +399,7 @@ export function AddressBookScreen({ route, navigation }: Props): JSX.Element {
{/* for DFI address */}
<WhitelistedAddressLink
address={item.address}
disabled={enableAddressSelect}
disabled={isAddressSelectDisabled}
testIDSuffix={`${index}_${testIDSuffix}`}
displayIcon={
activeButtonGroup === ButtonGroupTabKey.YourAddress
Expand All @@ -408,7 +408,7 @@ export function AddressBookScreen({ route, navigation }: Props): JSX.Element {
/>
{/* for EVM address */}
</View>
{enableAddressSelect && (
{!isAddressSelectDisabled && (
<TouchableOpacity
activeOpacity={0.7}
onPress={onDFIAddressClick}
Expand Down Expand Up @@ -520,7 +520,7 @@ export function AddressBookScreen({ route, navigation }: Props): JSX.Element {
onClick={async () => {
onChangeAddress(item.address);
}}
enableAddressSelect={enableAddressSelect}
isAddressSelectEnabled={false}
/>
{/* EVM address card */}
{isEvmFeatureEnabled && (
Expand All @@ -532,7 +532,7 @@ export function AddressBookScreen({ route, navigation }: Props): JSX.Element {
onClick={async () => {
onChangeAddress(item.evmAddress);
}}
enableAddressSelect={enableAddressSelect}
isAddressSelectEnabled={false}
/>
)}
</View>
Expand Down Expand Up @@ -842,14 +842,14 @@ function YourAddressLink({
address,
isEvmAddress,
testIDSuffix,
enableAddressSelect,
isAddressSelectEnabled,
}: {
disabled?: boolean;
onClick: () => Promise<void>;
address: string;
isEvmAddress?: boolean;
testIDSuffix: string;
enableAddressSelect: boolean;
isAddressSelectEnabled: boolean;
}) {
return (
<TouchableOpacity
Expand All @@ -874,7 +874,7 @@ function YourAddressLink({
</ThemedTextV2>
{isEvmAddress && <EvmTag index={1} testIDSuffix={testIDSuffix} />}
</View>
{enableAddressSelect && (
{isAddressSelectEnabled && (
<ThemedIcon
testID={`address_row_${testIDSuffix}_caret`}
light={tailwind("text-mono-light-v2-700")}
Expand Down

0 comments on commit 4266a32

Please sign in to comment.