Commit dd9d99f
feat(rewards): update mUSD calculator tab with slider and revamped design (#29758)
<!--
Please submit this PR as a draft initially.
Do not mark it as "Ready for review" until this PR meets the canonical
Definition of Ready For Review in `docs/readme/ready-for-review.md`.
In short: the template must be materially complete (not just section
titles
present), all status checks must be currently passing, and the only
expected
follow-up commits must be reviewer-driven.
-->
## **Description**
<!--
Write a short description of the changes included in this pull request,
also include relevant motivation and context. Have in mind the following
questions:
1. What is the reason for the change?
2. What is the improvement/solution?
-->
This PR replaces the placeholder mUSD Rewards tab with a
calculator-style experience so users can explore estimated earnings from
holding mUSD.
The tab now shows a hero (hold / earn messaging), an amount slider with
labeled scale points ($100–$10,000), estimated yearly / monthly / daily
earnings derived from a fixed APY constant, disclaimer copy, and primary
CTAs (buy / swap). Slider mapping, snapping, and clamping live in pure
helpers (`musdCalculatorSlider`) with unit tests. Strings are added
under `rewards.musd.*` across supported locales.
## **Changelog**
<!--
If this PR is not End-User-Facing and should not show up in the
CHANGELOG, you can choose to either:
1. Write `CHANGELOG entry: null`
2. Label with `no-changelog`
If this PR is End-User-Facing, please write a short User-Facing
description in the past tense like:
`CHANGELOG entry: Added a new tab for users to see their NFTs`
`CHANGELOG entry: Fixed a bug that was causing some NFTs to flicker`
(This helps the Release Engineer do their job more quickly and
accurately)
-->
CHANGELOG entry: Updated the mUSD bonus calculator in Rewards with a
fresh design.
## **Related issues**
No issue: Rewards mUSD calculator UI iteration (no GitHub or Jira ticket
linked).
## **Manual testing steps**
```gherkin
Feature: Rewards mUSD calculator tab
Scenario: User views calculator and adjusts amount
Given the user opens MetaMask Mobile and navigates to Rewards
When the user selects the mUSD calculator tab (or equivalent entry for mUSD)
Then the calculator hero, amount slider, estimated earnings, disclaimer, and CTAs are visible
Scenario: User moves the slider
Given the mUSD calculator tab is open
When the user drags the amount slider across the track
Then the displayed amount and estimated earnings update consistently and remain within the expected min/max range
```
## **Screenshots/Recordings**
<!-- If applicable, add screenshots and/or recordings to visualize the
before and after of your change. -->
### **Before**
N/A
### **After**
N/A
## **Pre-merge author checklist**
<!--
Every checklist item must be consciously assessed before marking this PR
as
"Ready for review". A checked box means you deliberately considered that
responsibility, not that you literally performed every action listed.
Unchecked boxes are ambiguous: they are not an implicit "N/A" and they
are not
a silent "skip". See `docs/readme/ready-for-review.md` for the full
checklist
semantics.
-->
- [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
- [x] 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
- Ideally on a mid-range device; emulator is acceptable
- [ ] I've tested with a power user scenario
- Use these [power-user
SRPs](https://consensyssoftware.atlassian.net/wiki/spaces/TL1/pages/edit-v2/401401446401?draftShareId=9d77e1e1-4bdc-4be1-9ebb-ccd916988d93)
to import wallets with many accounts and tokens
- [ ] I've instrumented key operations with Sentry traces for production
performance metrics
- See [`trace()`](/app/util/trace.ts) for usage and
[`addToken`](/app/components/Views/AddAsset/components/AddCustomToken/AddCustomToken.tsx#L274)
for an example
For performance guidelines and tooling, see the [Performance
Guide](https://consensyssoftware.atlassian.net/wiki/spaces/TL1/pages/400085549067/Performance+Guide+for+Engineers).
## **Pre-merge reviewer checklist**
<!--
Reviewer checklist items follow the same semantics as the author
checklist: an
unchecked box is ambiguous, a checked box means the reviewer consciously
assessed that responsibility. See `docs/readme/ready-for-review.md`.
-->
- [ ] 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.
<!-- Generated with the help of the pr-description AI skill -->
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Medium Risk**
> Medium risk due to a substantial UI rewrite introducing custom
gesture-driven slider behavior (Reanimated/Gesture Handler) and new i18n
keys, which could affect interaction/formatting and non-English copy if
translations are incomplete.
>
> **Overview**
> Replaces the Rewards mUSD calculator tab UI with a new slider-driven
experience: a redesigned hero/earnings display, editable amount input,
and a custom press/drag slider (with snapping/clamping) that updates
estimated daily/yearly earnings.
>
> Adds pure slider mapping helpers in `musdCalculatorSlider` (with unit
tests), updates button wiring/testIDs and interaction tests (press, pan
gestures, input normalization), and wraps `MusdCalculatorView` content
in a `KeyboardAvoidingView` with a new test.
>
> Updates `rewards.musd.*` strings (new English copy/keys) and removes
the prior localized string set in many non-English locale files.
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
fb1b788. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
---------
Co-authored-by: Christian Montoya <christian.montoya@consensys.net>1 parent c89c486 commit dd9d99f
21 files changed
Lines changed: 718 additions & 304 deletions
File tree
- app/components/UI/Rewards
- Views
- components/Tabs/MusdCalculatorTab
- utils
- locales/languages
Lines changed: 7 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
69 | 76 | | |
70 | 77 | | |
71 | 78 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
| |||
25 | 26 | | |
26 | 27 | | |
27 | 28 | | |
28 | | - | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
29 | 37 | | |
30 | 38 | | |
31 | 39 | | |
| |||
Lines changed: 181 additions & 48 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
7 | 45 | | |
8 | 46 | | |
9 | 47 | | |
| |||
22 | 60 | | |
23 | 61 | | |
24 | 62 | | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
25 | 70 | | |
26 | 71 | | |
27 | 72 | | |
| |||
43 | 88 | | |
44 | 89 | | |
45 | 90 | | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
46 | 94 | | |
47 | 95 | | |
48 | 96 | | |
| |||
51 | 99 | | |
52 | 100 | | |
53 | 101 | | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
67 | 115 | | |
68 | 116 | | |
69 | 117 | | |
70 | 118 | | |
71 | 119 | | |
72 | 120 | | |
73 | 121 | | |
74 | | - | |
75 | | - | |
| 122 | + | |
| 123 | + | |
76 | 124 | | |
77 | 125 | | |
78 | 126 | | |
| |||
87 | 135 | | |
88 | 136 | | |
89 | 137 | | |
90 | | - | |
91 | | - | |
| 138 | + | |
| 139 | + | |
92 | 140 | | |
93 | 141 | | |
94 | 142 | | |
| |||
100 | 148 | | |
101 | 149 | | |
102 | 150 | | |
103 | | - | |
104 | | - | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
105 | 160 | | |
106 | | - | |
107 | | - | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
108 | 165 | | |
109 | | - | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
110 | 180 | | |
111 | 181 | | |
112 | | - | |
113 | | - | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
114 | 193 | | |
115 | | - | |
116 | | - | |
| 194 | + | |
117 | 195 | | |
118 | | - | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
119 | 199 | | |
120 | 200 | | |
121 | | - | |
122 | | - | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
123 | 207 | | |
124 | | - | |
125 | | - | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
126 | 230 | | |
127 | | - | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
128 | 238 | | |
129 | 239 | | |
130 | | - | |
| 240 | + | |
131 | 241 | | |
132 | 242 | | |
133 | | - | |
134 | | - | |
135 | | - | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
136 | 246 | | |
137 | | - | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
138 | 251 | | |
139 | 252 | | |
140 | | - | |
141 | | - | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
142 | 256 | | |
143 | | - | |
144 | | - | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
145 | 266 | | |
146 | | - | |
147 | | - | |
148 | | - | |
149 | 267 | | |
150 | | - | |
151 | | - | |
152 | | - | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
153 | 272 | | |
154 | 273 | | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
155 | 288 | | |
0 commit comments