Commit 66b8511
authored
feat: MUSD-737, MUSD-738 — Earnings section refresh (#29647)
## **Description**
Two adjustments to the Money Home Earnings section.
- **MUSD-737** replaces the `Lifetime earnings` and `Projected earnings`
metrics on the Earnings card with forward-looking `Est. monthly
earnings` and `Est. yearly earnings`. Values are computed from the
user's Money Account balance and the current vault APY using the
existing `calculateProjectedEarnings` utility (years = 1/12 and 1
respectively). The previous `+green` color treatment on the lifetime
value is dropped — projections aren't past gains.
- **MUSD-738** drops the `condensed` collapse path on
`MoneyPotentialEarnings` so up to five convertible-token rows always
render when the user has eligible tokens, regardless of Money Account
transaction count. The `Earn on your crypto` single-CTA card no longer
appears mid-state. `MoneyMusdTokenRow` and `MoneyActivityList` are
unchanged.
Locale strings: the `money.earnings.lifetime` /
`money.earnings.projected` keys are renamed to
`money.earnings.estimated_monthly` / `money.earnings.estimated_yearly`
across all language files. The `money.earnings_tooltip.lifetime_*` /
`projected_*` keys are renamed to `monthly_*` / `yearly_*` so the
info-sheet copy mirrors the new section framing.
## **Changelog**
CHANGELOG entry: null
## **Related issues**
Fixes:
- https://consensyssoftware.atlassian.net/browse/MUSD-737
- https://consensyssoftware.atlassian.net/browse/MUSD-738
## **Manual testing steps**
```gherkin
Feature: Money Home Earnings section refresh
Scenario: user with a non-zero Money Account balance opens Money Home
Given the Money Account feature flag is enabled
And the user has a Money Account balance greater than $0
When the user navigates to Money Home
Then the Earnings card shows "Est. monthly earnings" and "Est. yearly earnings"
And both values reflect balance × APY scaled to the relevant period
And no "Lifetime earnings" or "Projected earnings" labels are visible
Scenario: user with at least one Money Account transaction sees convertible tokens
Given the user has Money Account transaction count greater than 0
And the user has at least one convertible token with a positive fiat balance
When the user scrolls to the Earnings area on Money Home
Then up to five convertible-token rows are rendered
And no "Earn on your crypto" / "View potential earnings" collapsed card is shown
Scenario: user opens the Earnings info sheet
Given Money Home is open
When the user taps the info icon next to the Earnings section title
Then the info sheet shows "Est. monthly earnings" and "Est. yearly earnings" headings
And the body copy describes monthly and yearly projections
```
## **Screenshots/Recordings**
### **Before**
<!-- to be added -->
### **After**
<!-- to be added -->
## **Pre-merge author checklist**
- [ ] 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).
- [ ] I've completed the PR template to the best of my ability
- [ ] I've included tests if applicable
- [ ] I've documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [ ] 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**
- [ ] I've manually tested the PR (e.g. pull and build branch, run the
app, test code being changed).
- [ ] 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]
> **Low Risk**
> Low risk UI/UX change that adjusts earnings calculations/labels and
removes a display mode; main risk is incorrect projections or
regressions in Money Home navigation/press handlers.
>
> **Overview**
> Updates Money Home’s Earnings card to show **estimated monthly** and
**annual** earnings instead of lifetime/projected values, computing both
from current balance and APY (with additional guards for invalid/zero
inputs).
>
> Removes `MoneyPotentialEarnings` “condensed” mode so up to five
convertible token rows always render when eligible tokens exist, and
simplifies the earnings info sheet copy/strings to a single “estimated
earnings” message. Tests were updated/expanded to cover the new metrics
and key navigation/press behaviors (conversion, token row press,
learn-more, and error logging).
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
175f4cd. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->1 parent 5bfeb29 commit 66b8511
11 files changed
Lines changed: 286 additions & 304 deletions
File tree
- app/components/UI/Money
- Views/MoneyHomeView
- components
- MoneyEarningsInfoSheet
- MoneyEarnings
- MoneyPotentialEarnings
- locales/languages
Lines changed: 156 additions & 17 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| 28 | + | |
28 | 29 | | |
29 | 30 | | |
30 | 31 | | |
| 32 | + | |
31 | 33 | | |
32 | 34 | | |
33 | 35 | | |
| |||
72 | 74 | | |
73 | 75 | | |
74 | 76 | | |
75 | | - | |
76 | | - | |
77 | | - | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
78 | 87 | | |
79 | 88 | | |
80 | 89 | | |
| |||
98 | 107 | | |
99 | 108 | | |
100 | 109 | | |
| 110 | + | |
| 111 | + | |
101 | 112 | | |
102 | 113 | | |
103 | 114 | | |
| |||
119 | 130 | | |
120 | 131 | | |
121 | 132 | | |
122 | | - | |
| 133 | + | |
123 | 134 | | |
124 | 135 | | |
125 | | - | |
126 | | - | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
127 | 147 | | |
128 | | - | |
| 148 | + | |
129 | 149 | | |
130 | 150 | | |
131 | 151 | | |
| |||
134 | 154 | | |
135 | 155 | | |
136 | 156 | | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
137 | 161 | | |
138 | 162 | | |
139 | 163 | | |
140 | 164 | | |
141 | 165 | | |
142 | 166 | | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
143 | 172 | | |
144 | 173 | | |
145 | 174 | | |
| |||
339 | 368 | | |
340 | 369 | | |
341 | 370 | | |
342 | | - | |
343 | 371 | | |
344 | 372 | | |
345 | 373 | | |
346 | | - | |
347 | | - | |
| 374 | + | |
| 375 | + | |
348 | 376 | | |
349 | 377 | | |
350 | 378 | | |
351 | 379 | | |
352 | | - | |
353 | | - | |
354 | | - | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
355 | 393 | | |
356 | 394 | | |
357 | | - | |
| 395 | + | |
358 | 396 | | |
359 | 397 | | |
360 | 398 | | |
| |||
373 | 411 | | |
374 | 412 | | |
375 | 413 | | |
376 | | - | |
377 | | - | |
378 | | - | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
379 | 417 | | |
380 | 418 | | |
381 | 419 | | |
| |||
599 | 637 | | |
600 | 638 | | |
601 | 639 | | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
| 673 | + | |
| 674 | + | |
| 675 | + | |
| 676 | + | |
| 677 | + | |
| 678 | + | |
| 679 | + | |
| 680 | + | |
| 681 | + | |
| 682 | + | |
| 683 | + | |
| 684 | + | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
| 690 | + | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
| 694 | + | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
| 707 | + | |
| 708 | + | |
| 709 | + | |
| 710 | + | |
| 711 | + | |
| 712 | + | |
| 713 | + | |
| 714 | + | |
| 715 | + | |
| 716 | + | |
| 717 | + | |
| 718 | + | |
| 719 | + | |
| 720 | + | |
| 721 | + | |
| 722 | + | |
| 723 | + | |
| 724 | + | |
| 725 | + | |
| 726 | + | |
| 727 | + | |
| 728 | + | |
| 729 | + | |
| 730 | + | |
| 731 | + | |
| 732 | + | |
| 733 | + | |
| 734 | + | |
| 735 | + | |
| 736 | + | |
| 737 | + | |
| 738 | + | |
| 739 | + | |
| 740 | + | |
602 | 741 | | |
603 | 742 | | |
604 | 743 | | |
| |||
Lines changed: 22 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
86 | 86 | | |
87 | 87 | | |
88 | 88 | | |
89 | | - | |
| 89 | + | |
90 | 90 | | |
91 | 91 | | |
92 | 92 | | |
93 | | - | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
94 | 111 | | |
95 | 112 | | |
96 | 113 | | |
| |||
141 | 158 | | |
142 | 159 | | |
143 | 160 | | |
144 | | - | |
145 | 161 | | |
146 | | - | |
| 162 | + | |
147 | 163 | | |
148 | 164 | | |
149 | 165 | | |
| |||
248 | 264 | | |
249 | 265 | | |
250 | 266 | | |
251 | | - | |
252 | | - | |
| 267 | + | |
| 268 | + | |
253 | 269 | | |
254 | 270 | | |
255 | 271 | | |
| |||
285 | 301 | | |
286 | 302 | | |
287 | 303 | | |
288 | | - | |
289 | 304 | | |
290 | 305 | | |
291 | 306 | | |
| |||
0 commit comments