Commit a4522a3
authored
feat(rewards): update campaigns feature flag behavior on dashboard (MetaMask#27803)
## **Description**
Updates how the campaigns feature flag controls behavior on the Rewards
Dashboard:
- **Dashboard always renders** `CampaignsPreview` and
`EarnRewardsPreview` components regardless of feature flag state
- **Feature flag logic moved to `useRewardCampaigns` hook** - when
disabled:
- Shows only upcoming campaigns (filtered by start date)
- Falls back to previous season campaigns if no upcoming campaigns exist
- **Campaign tiles become non-interactive when disabled** - users cannot
navigate to campaign details
- **Adds `fetchUpcomingOrPreviousSeasonCampaigns`** method to
RewardsController for the fallback logic
### Key Changes
| Before | After |
|--------|-------|
| Feature flag hides entire campaigns section | Always shows campaigns
section |
| N/A | When disabled: shows upcoming campaigns only |
| N/A | When disabled: falls back to previous season |
| All tiles navigable | Non-interactive tiles when flag disabled |
## **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: null
## **Related issues**
_N/A_
## **Manual testing steps**
1. Enable campaigns feature flag → Full campaigns functionality
2. Disable campaigns feature flag → Only upcoming campaigns shown, tiles
non-interactive
3. Disable flag with no upcoming campaigns → Previous season campaigns
displayed
## **Screenshots/Recordings**
- Feature flag off: only show upcoming campaign as featured
<img width="983" height="1958" alt="Screenshot from 2026-03-23 14-16-10"
src="https://github.com/user-attachments/assets/97c27a9d-0bfd-4fe7-b058-24d59fbf2652"
/>
- Feature flag off: tapping section or featured tile on rewards
dashboard leads to campaign overview page. Only previous season tile is
tappable
<img width="983" height="1958" alt="Screenshot from 2026-03-23 14-16-17"
src="https://github.com/user-attachments/assets/954d9a27-0a73-47c7-8c0d-029adc4a59eb"
/>
- Feature flag off: what would happen if no upcoming campaigns are
found, we can fallback to the previous season tile, which would take you
to the previous season summary if it/the section is tapped.
<img width="983" height="1958" alt="Screenshot from 2026-03-23 14-17-30"
src="https://github.com/user-attachments/assets/6618359a-f2cd-470b-b17a-9a00319c7f68"
/>
- If feature flag is on, then we will not filter on upcoming and allow
users to actually navigate to the campaign details page via campaign
tiles.
## **Pre-merge author checklist**
- [x] I've followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs)
- [x] I've completed the PR template
- [x] I've included tests
- [x] I've documented any changes (if applicable)
## **Pre-merge reviewer checklist**
- [ ] I've verified the changes follow established patterns
- [ ] I've verified the test coverage is adequate
Made with [Cursor](https://cursor.com)
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Medium Risk**
> Moderate UI/behavior change around the campaigns feature flag that
alters what content is shown and which navigation paths are enabled;
risk is mainly regressions in campaign visibility and tap behavior when
the flag toggles.
>
> **Overview**
> **Rewards dashboard now always renders** `CampaignsPreview` and
`EarnRewardsPreview`, removing the prior conditional/previous-season UI
paths (including the referral header action).
>
> **Campaign feature flag behavior is pushed down into campaigns
components/hooks:** `useRewardCampaigns` always fetches campaigns when
subscribed but filters results to *upcoming-only* when the flag is off,
while `CampaignTile` adds `isInteractive`/`onPress` to disable deep-link
navigation and allow alternate navigation. `CampaignsPreview` adds a
no-campaigns fallback that shows `PreviousSeasonTile` and navigates to
`Routes.PREVIOUS_SEASON_VIEW`.
>
> Tests were updated accordingly across `RewardsDashboard`,
`CampaignsPreview`, `CampaignTile`, `useRewardCampaigns`, and
`RewardsController` to reflect the new fetch/filtering and interactivity
rules.
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
9ca3bc0. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->1 parent 6e0f698 commit a4522a3
11 files changed
Lines changed: 468 additions & 1583 deletions
File tree
- app
- components/UI/Rewards
- Views
- components/Campaigns
- hooks
- core/Engine/controllers/rewards-controller
Lines changed: 171 additions & 1451 deletions
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
2 | | - | |
3 | | - | |
4 | | - | |
5 | | - | |
6 | | - | |
7 | | - | |
| 1 | + | |
8 | 2 | | |
9 | 3 | | |
10 | 4 | | |
| |||
19 | 13 | | |
20 | 14 | | |
21 | 15 | | |
22 | | - | |
23 | | - | |
24 | 16 | | |
25 | 17 | | |
26 | | - | |
27 | 18 | | |
28 | 19 | | |
29 | 20 | | |
30 | 21 | | |
31 | 22 | | |
32 | 23 | | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | 24 | | |
40 | 25 | | |
41 | 26 | | |
42 | 27 | | |
43 | | - | |
44 | 28 | | |
45 | 29 | | |
46 | 30 | | |
| |||
55 | 39 | | |
56 | 40 | | |
57 | 41 | | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | 42 | | |
62 | 43 | | |
63 | 44 | | |
| |||
73 | 54 | | |
74 | 55 | | |
75 | 56 | | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | 57 | | |
82 | 58 | | |
83 | 59 | | |
| |||
127 | 103 | | |
128 | 104 | | |
129 | 105 | | |
130 | | - | |
131 | | - | |
132 | | - | |
133 | | - | |
134 | | - | |
135 | | - | |
136 | | - | |
137 | | - | |
138 | 106 | | |
139 | 107 | | |
140 | 108 | | |
141 | 109 | | |
142 | 110 | | |
143 | | - | |
144 | | - | |
145 | | - | |
146 | | - | |
147 | | - | |
148 | | - | |
149 | | - | |
150 | 111 | | |
151 | 112 | | |
152 | 113 | | |
| |||
182 | 143 | | |
183 | 144 | | |
184 | 145 | | |
185 | | - | |
186 | | - | |
187 | 146 | | |
188 | 147 | | |
189 | 148 | | |
| |||
232 | 191 | | |
233 | 192 | | |
234 | 193 | | |
235 | | - | |
236 | | - | |
237 | | - | |
238 | | - | |
239 | | - | |
240 | | - | |
241 | | - | |
242 | | - | |
243 | | - | |
244 | | - | |
245 | | - | |
246 | 194 | | |
247 | 195 | | |
248 | 196 | | |
249 | | - | |
250 | | - | |
251 | | - | |
252 | | - | |
253 | | - | |
254 | | - | |
255 | | - | |
256 | | - | |
257 | | - | |
258 | | - | |
259 | | - | |
260 | | - | |
261 | | - | |
262 | | - | |
263 | | - | |
264 | | - | |
265 | | - | |
266 | | - | |
267 | | - | |
268 | | - | |
269 | | - | |
270 | | - | |
271 | | - | |
272 | | - | |
273 | | - | |
274 | | - | |
275 | | - | |
276 | | - | |
277 | | - | |
278 | | - | |
279 | | - | |
| 197 | + | |
| 198 | + | |
280 | 199 | | |
281 | 200 | | |
282 | 201 | | |
| |||
Lines changed: 41 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
335 | 335 | | |
336 | 336 | | |
337 | 337 | | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
338 | 379 | | |
339 | 380 | | |
Lines changed: 28 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
29 | 39 | | |
30 | 40 | | |
31 | 41 | | |
32 | 42 | | |
33 | | - | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
34 | 47 | | |
35 | | - | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
36 | 53 | | |
37 | 54 | | |
38 | 55 | | |
| |||
58 | 75 | | |
59 | 76 | | |
60 | 77 | | |
61 | | - | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
62 | 85 | | |
63 | 86 | | |
64 | 87 | | |
65 | 88 | | |
66 | 89 | | |
| 90 | + | |
67 | 91 | | |
68 | 92 | | |
69 | 93 | | |
70 | | - | |
| 94 | + | |
71 | 95 | | |
72 | 96 | | |
73 | 97 | | |
| |||
Lines changed: 8 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
| 2 | + | |
2 | 3 | | |
3 | 4 | | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
7 | | - | |
| 8 | + | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
| |||
23 | 24 | | |
24 | 25 | | |
25 | 26 | | |
| 27 | + | |
26 | 28 | | |
27 | 29 | | |
28 | 30 | | |
| |||
35 | 37 | | |
36 | 38 | | |
37 | 39 | | |
38 | | - | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
39 | 45 | | |
40 | 46 | | |
41 | 47 | | |
| |||
Lines changed: 52 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
17 | 26 | | |
18 | 27 | | |
19 | 28 | | |
| |||
42 | 51 | | |
43 | 52 | | |
44 | 53 | | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
45 | 68 | | |
46 | 69 | | |
47 | 70 | | |
| |||
82 | 105 | | |
83 | 106 | | |
84 | 107 | | |
85 | | - | |
86 | | - | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
87 | 124 | | |
88 | | - | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
89 | 129 | | |
90 | 130 | | |
91 | 131 | | |
| |||
248 | 288 | | |
249 | 289 | | |
250 | 290 | | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
251 | 300 | | |
0 commit comments