Skip to content

Commit e6f32b0

Browse files
chore(runway): cherry-pick fix: cp-7.58.0 rewards settings change icon open modal (#21522)
- fix: cp-7.58.0 rewards settings change icon open modal (#21473) ## **Description** Change icon to spawn account group modal in reward settings page to details icon instead of QR. ## **Changelog** CHANGELOG entry: null ## **Screenshots/Recordings** ### **After** <img width="495" height="944" alt="image" src="https://github.com/user-attachments/assets/12f7db40-34c5-4c14-a5de-177b05ccbb1a" /> <!-- CURSOR_SUMMARY --> --- > [!NOTE] > Replaces the QR code icon with the details icon to open the account addresses modal and updates related tests/mocks, with a small try/catch cleanup. > > - **Rewards Settings UI**: > - Change addresses action button icon from `IconNameDS.QrCode` to `IconNameDS.Details` in `RewardSettingsAccountGroup.tsx`. > - Minor cleanup: simplify `catch {}` when selecting EVM address. > - **Tests & Mocks**: > - Update tests in `RewardSettingsAccountGroup.test.tsx` to reference the addresses button (formerly QR) and expect navigation/disabled states. > - Adjust mocked `IconName` to include `Details` and remove `QrCode` where used. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 4583764. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY --> [38ccc8e](38ccc8e) Co-authored-by: VGR <[email protected]>
1 parent da822ec commit e6f32b0

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

app/components/UI/Rewards/components/Settings/RewardSettingsAccountGroup.test.tsx

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ jest.mock('@metamask/design-system-react-native', () => {
169169
Lg: 'lg',
170170
},
171171
IconName: {
172-
QrCode: 'qr-code',
172+
Details: 'details',
173173
Check: 'check',
174174
Add: 'add',
175175
},
@@ -254,7 +254,7 @@ jest.mock('../../../../../component-library/components/Icons/Icon', () => {
254254
__esModule: true,
255255
default: MockIcon,
256256
IconName: {
257-
QrCode: 'qr-code',
257+
Details: 'details',
258258
Check: 'check',
259259
Add: 'add',
260260
},
@@ -611,18 +611,18 @@ describe('RewardSettingsAccountGroup', () => {
611611
expect(mockLinkAccountGroup).toHaveBeenCalledWith(mockAccountGroup.id);
612612
});
613613

614-
it('should navigate to modal when QR button is pressed', () => {
614+
it('navigates to modal when addresses button is pressed', () => {
615615
const { getByTestId } = render(
616616
<RewardSettingsAccountGroup
617617
item={mockItem}
618618
avatarAccountType={AvatarAccountType.Maskicon}
619619
/>,
620620
);
621621

622-
const qrButton = getByTestId(
622+
const addressesButton = getByTestId(
623623
`rewards-account-addresses-${mockAccountGroup.id}`,
624624
);
625-
fireEvent.press(qrButton);
625+
fireEvent.press(addressesButton);
626626

627627
expect(mockNavigate).toHaveBeenCalledWith(
628628
'RewardOptInAccountGroupModal',
@@ -646,7 +646,7 @@ describe('RewardSettingsAccountGroup', () => {
646646
);
647647
});
648648

649-
it('should navigate to modal with unsupported accounts included in addressData', () => {
649+
it('navigates to modal with unsupported accounts included in addressData', () => {
650650
const itemWithUnsupported: RewardSettingsAccountGroupListFlatListItem = {
651651
type: 'accountGroup',
652652
accountGroup: {
@@ -681,10 +681,10 @@ describe('RewardSettingsAccountGroup', () => {
681681
/>,
682682
);
683683

684-
const qrButton = getByTestId(
684+
const addressesButton = getByTestId(
685685
`rewards-account-addresses-${mockAccountGroup.id}`,
686686
);
687-
fireEvent.press(qrButton);
687+
fireEvent.press(addressesButton);
688688

689689
expect(mockNavigate).toHaveBeenCalledWith(
690690
'RewardOptInAccountGroupModal',
@@ -1008,7 +1008,7 @@ describe('RewardSettingsAccountGroup', () => {
10081008
).toBeNull();
10091009
});
10101010

1011-
it('should disable QR button when loading', () => {
1011+
it('disables addresses button when loading', () => {
10121012
// Arrange
10131013
mockUseLinkAccountGroup.mockReturnValue({
10141014
linkAccountGroup: mockLinkAccountGroup,
@@ -1025,10 +1025,10 @@ describe('RewardSettingsAccountGroup', () => {
10251025
);
10261026

10271027
// Assert
1028-
const qrButton = getByTestId(
1028+
const addressesButton = getByTestId(
10291029
`rewards-account-addresses-${mockAccountGroup.id}`,
10301030
);
1031-
expect(qrButton).toHaveProp('disabled', true);
1031+
expect(addressesButton).toHaveProp('disabled', true);
10321032
});
10331033
});
10341034
});

app/components/UI/Rewards/components/Settings/RewardSettingsAccountGroup.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ const RewardSettingsAccountGroup: React.FC<RewardSettingsAccountGroupProps> = ({
6262
try {
6363
const selector = selectIconSeedAddressByAccountGroupId(accountGroup.id);
6464
return selector(state);
65-
} catch (error) {
65+
} catch {
6666
return undefined;
6767
}
6868
});
@@ -204,9 +204,9 @@ const RewardSettingsAccountGroup: React.FC<RewardSettingsAccountGroupProps> = ({
204204
twClassName="gap-4"
205205
testID={`rewards-account-group-actions-${accountGroup.id}`}
206206
>
207-
{/* QR Code button to show account addresses */}
207+
{/* Menu button to show account addresses */}
208208
<ButtonIcon
209-
iconName={IconNameDS.QrCode}
209+
iconName={IconNameDS.Details}
210210
size={ButtonIconSize.Lg}
211211
onPress={handleShowAddresses}
212212
isDisabled={isLoading}

0 commit comments

Comments
 (0)