Skip to content

Commit 385df81

Browse files
chore(runway): cherry-pick fix(MUSD-651): polish Cash & mUSD UI per latest designs cp-7.74.0 (#28996)
- fix(MUSD-651): polish Cash & mUSD UI per latest designs cp-7.74.0 (#28921) ## **Description** Implements the four remaining MUSD-651 polish items on the Cash full view, mUSD asset detail page, and home Cash section. Audit confirmed the other ticket items (tooltip icon color, stablecoin tag checkmarks/dark-mode fill, 3% bonus tag on home) already shipped in PRs #28479, #28656, and #28718. **Lifetime bonus formatting** — `AssetOverviewClaimBonus` now renders `$0.00` in default text color until the user has actually claimed a bonus, then switches to `+$X` in `SuccessDefault` green. Previously always rendered `+$0.00` in green. **Get mUSD CTA** — `MusdConversionAssetListCta` button promoted from `Secondary` to `Primary` to match the white-on-dark Figma spec; redundant inner `<Text>` color override dropped so the Button can drive its own text color from the variant. **Drop "Claim bonus" link from token rows** — `MusdAggregatedRow` (home Cash section) and `TokenListItem` (mUSD per-network rows) no longer render the blue "Claim bonus" affordance when a bonus is claimable. They fall through to the green "3% bonus" label instead. The claim CTA still lives on the mUSD asset detail page (`AssetOverviewClaimBonus`), which is now the canonical claim entry point. **Padding above "Convert your stablecoins"** — bumped top padding (`pt-3`) inside `MoneyConvertStablecoins` so the divider isn't flush with the title. `MusdAggregatedRow` also dropped its now-unused `useMerklBonusClaim`, `useNetworkName`, and analytics dependencies — the removed click handler was the only reason the hook was called. **Note:** claim bonus tag shape is addressed separately in [this PR](#28903). ## **Changelog** CHANGELOG entry: Polished Cash and mUSD bonus UI: lifetime bonus shows zero state in white, "Get mUSD" CTA is now primary, blue "Claim bonus" link removed from token rows. ## **Related issues** Fixes: MUSD-651 ## **Manual testing steps** ```gherkin Feature: MUSD-651 Cash & mUSD UI polish Scenario: lifetime bonus shows zero state in white Given the user has never claimed an mUSD bonus When user opens the Cash full view from Home → Cash header Then the "Lifetime bonus claimed" row reads "$0.00" in default (white) text Scenario: lifetime bonus shows positive amount in green Given the user has previously claimed at least one mUSD bonus When user opens the Cash full view Then the "Lifetime bonus claimed" row reads "+$<amount>" in green Scenario: Get mUSD CTA is primary Given the user has no mUSD balance and is geo-eligible When user views the home wallet asset list Then the "Get mUSD" CTA renders as a primary (white-on-dark) button Scenario: Cash row never shows blue "Claim bonus" link Given the user has a claimable mUSD bonus on Linea When user views Home → Cash section Then the row shows green "3% bonus" text (no blue "Claim bonus" link) And tapping the row navigates to the Cash full view Scenario: token list mUSD rows never show "Claim bonus" Given the user holds mUSD across multiple chains with claimable rewards When user opens the Cash full view Then each mUSD row in the token list shows green "3% bonus" (no blue link) And the "Claim $X bonus" CTA on the asset detail "Your bonus" section still works Scenario: spacing above "Convert your stablecoins" Given the user is on the Cash full view When user scrolls to the "Convert your stablecoins" section Then there is visible breathing room between the divider line and the section title ``` ## **Screenshots/Recordings** <img width="1206" height="2622" alt="image" src="https://github.com/user-attachments/assets/642d6690-5896-48ca-b01f-3d47b26a493b" /> <img width="1206" height="2622" alt="image" src="https://github.com/user-attachments/assets/8d72bb20-608e-49d1-b694-a3624f485292" /> ## **Pre-merge author checklist** - [x] I've followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile Coding Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md). - [x] I've completed the PR template to the best of my ability - [x] I've included tests if applicable - [ ] I've documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [x] I've applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. #### Performance checks (if applicable) - [ ] I've tested on Android - [ ] I've tested with a power user scenario - [ ] I've instrumented key operations with Sentry traces for production performance metrics ## **Pre-merge reviewer checklist** - [x] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed). - [x] I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots. <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Medium Risk** > UI/UX behavior changes around when/where users can claim mUSD bonuses (removing claim affordances from token rows) plus token list rendering tweaks could affect discoverability and row layout, but no core auth or funds-transfer logic is modified. > > **Overview** > Polishes mUSD bonus presentation to match updated designs: `AssetOverviewClaimBonus` now shows lifetime bonus as **`$0.00` in default text** until a first claim, switching to **green `+$X`** only when non-zero, and tests are updated accordingly. > > Updates Cash and token list rows to stop showing the previous inline *claim bonus* affordance: `TokenListItem` removes `useMerklBonusClaim`/spinner/claim handling entirely and, when eligible, renders a dedicated mUSD “`3% bonus`” row layout (hiding the price rail), while `MusdAggregatedRow` standardizes the label to “`Claim 3% bonus`” when claimable and uses the design-system spinner; analytics properties are adjusted to match the new button text. > > Small UI tweaks: promotes the “Get mUSD” asset-list CTA button to `Primary` (letting the Button control text styling), adds top padding in `MoneyConvertStablecoins`, and simplifies `TokenList` by removing viewability state/props and dropping the `scrollToMerklRewards` navigation param type. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit c6155a3. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY --> [775a207](775a207) Co-authored-by: Alexey Kureev <a.g.kureev@gmail.com>
1 parent 03c356b commit 385df81

12 files changed

Lines changed: 172 additions & 507 deletions

File tree

app/components/UI/Earn/components/AssetOverviewClaimBonus/AssetOverviewClaimBonus.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ describe('AssetOverviewClaimBonus', () => {
319319
).toHaveTextContent('+$0.00');
320320
expect(
321321
getByTestId(ASSET_OVERVIEW_CLAIM_BONUS_TEST_IDS.LIFETIME_VALUE),
322-
).toHaveTextContent('+$0.00');
322+
).toHaveTextContent('$0.00');
323323
});
324324
});
325325

app/components/UI/Earn/components/AssetOverviewClaimBonus/AssetOverviewClaimBonus.tsx

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -121,10 +121,11 @@ const AssetOverviewClaimBonus: React.FC<AssetOverviewClaimBonusProps> = ({
121121
? `+$${estimatedAnnualBonus.toFixed(2)}`
122122
: '+$0.00';
123123

124-
// Lifetime bonus
125-
const formattedLifetimeBonus = lifetimeBonusClaimed
124+
// Lifetime bonus: white $0.00 until first claim, then green +$X.
125+
const hasLifetimeBonus = Number(lifetimeBonusClaimed) > 0;
126+
const formattedLifetimeBonus = hasLifetimeBonus
126127
? `+$${lifetimeBonusClaimed}`
127-
: '+$0.00';
128+
: '$0.00';
128129

129130
// CTA state
130131
const { ctaLabel, ctaDisabled } = useMemo(() => {
@@ -320,7 +321,11 @@ const AssetOverviewClaimBonus: React.FC<AssetOverviewClaimBonusProps> = ({
320321
<Text
321322
variant={TextVariant.BodyMd}
322323
fontWeight={FontWeight.Medium}
323-
color={TextColor.SuccessDefault}
324+
color={
325+
hasLifetimeBonus
326+
? TextColor.SuccessDefault
327+
: TextColor.TextDefault
328+
}
324329
testID={ASSET_OVERVIEW_CLAIM_BONUS_TEST_IDS.LIFETIME_VALUE}
325330
>
326331
{formattedLifetimeBonus}

app/components/UI/Earn/components/Musd/MusdConversionAssetListCta/index.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -204,14 +204,12 @@ const MusdConversionAssetListCta = () => {
204204
</View>
205205

206206
<Button
207-
variant={ButtonVariant.Secondary}
207+
variant={ButtonVariant.Primary}
208208
style={styles.button}
209209
onPress={() => handlePress(CTA_CLICK_TARGET.CTA_BUTTON)}
210210
size={ButtonSize.Sm}
211211
>
212-
<Text variant={TextVariant.BodySMMedium} color={TextColor.Default}>
213-
{buttonText}
214-
</Text>
212+
{buttonText}
215213
</Button>
216214
</View>
217215
);

app/components/UI/Money/components/MoneyConvertStablecoins/MoneyConvertStablecoins.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ const MoneyConvertStablecoins = ({
136136

137137
return (
138138
<Box testID={MoneyConvertStablecoinsTestIds.CONTAINER}>
139-
<Box twClassName="px-4">
139+
<Box twClassName="px-4 pt-3">
140140
{!hasTokens && (
141141
<Box
142142
twClassName="mb-4"

app/components/UI/Tokens/TokenList/TokenList.tsx

Lines changed: 3 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
1-
import React, {
2-
useCallback,
3-
useRef,
4-
useMemo,
5-
useEffect,
6-
useState,
7-
} from 'react';
1+
import React, { useCallback, useRef, useMemo, useEffect } from 'react';
82
import { DeviceEventEmitter, RefreshControl } from 'react-native';
9-
import { FlashList, FlashListRef, ViewToken } from '@shopify/flash-list';
3+
import { FlashList, FlashListRef } from '@shopify/flash-list';
104
import { useSelector } from 'react-redux';
115
import { useTheme } from '../../../../util/theme';
126
import {
@@ -144,18 +138,6 @@ const TokenListComponent = ({
144138
[],
145139
);
146140

147-
// Track which items are currently visible in the viewport.
148-
const [visibleKeys, setVisibleKeys] = useState<Set<string>>(new Set());
149-
150-
const handleViewableItemsChanged = useCallback(
151-
({ viewableItems }: { viewableItems: ViewToken<FlashListAssetKey>[] }) => {
152-
setVisibleKeys(
153-
new Set(viewableItems.map(({ item }) => getTokenKey(item))),
154-
);
155-
},
156-
[getTokenKey],
157-
);
158-
159141
const renderTokenListItem = useCallback(
160142
({ item }: { item: FlashListAssetKey }) => (
161143
<TokenListItem
@@ -166,7 +148,6 @@ const TokenListComponent = ({
166148
showPercentageChange={showPercentageChange}
167149
isFullView={isFullView}
168150
shouldShowTokenListItemCta={shouldShowTokenListItemCta}
169-
isVisible={visibleKeys.has(getTokenKey(item))}
170151
/>
171152
),
172153
[
@@ -176,8 +157,6 @@ const TokenListComponent = ({
176157
showPercentageChange,
177158
isFullView,
178159
shouldShowTokenListItemCta,
179-
visibleKeys,
180-
getTokenKey,
181160
],
182161
);
183162

@@ -196,7 +175,6 @@ const TokenListComponent = ({
196175
showPercentageChange={showPercentageChange}
197176
isFullView={isFullView}
198177
shouldShowTokenListItemCta={shouldShowTokenListItemCta}
199-
isVisible
200178
/>
201179
))}
202180
{shouldShowViewAllButton && (
@@ -219,11 +197,6 @@ const TokenListComponent = ({
219197
testID={WalletViewSelectorsIDs.TOKENS_CONTAINER_LIST}
220198
data={displayTokenKeys}
221199
removeClippedSubviews={false}
222-
viewabilityConfig={{
223-
itemVisiblePercentThreshold: 50,
224-
minimumViewTime: 1000,
225-
}}
226-
onViewableItemsChanged={handleViewableItemsChanged}
227200
renderItem={renderTokenListItem}
228201
keyExtractor={(item, idx) => `${getTokenKey(item)}-${idx}`}
229202
refreshControl={
@@ -234,7 +207,7 @@ const TokenListComponent = ({
234207
onRefresh={onRefresh}
235208
/>
236209
}
237-
extraData={{ isTokenNetworkFilterEqualCurrentNetwork, visibleKeys }}
210+
extraData={{ isTokenNetworkFilterEqualCurrentNetwork }}
238211
contentContainerStyle={!isFullView ? undefined : tw`px-4`}
239212
ListFooterComponent={
240213
isFullView && listFooterComponent ? (

0 commit comments

Comments
 (0)