Commit 340209c
refactor(rewards): lift portfolio and leaderboard position hook calls to parent views (#28049)
## **Description**
This PR refactors how `OndoCampaignDetailsView` decides which sections
to render, replacing ad-hoc inline conditions with a single `useMemo`
that computes five boolean flags. It also replaces
`CampaignEntriesClosedBanner` with `RewardsInfoBanner` for a unified
visual treatment.
### Other changes
- `OndoLeaderboard`: new `showTitle` prop (default `true`) — parent can
suppress the section title when rendering inline. `computedAt` timestamp
moves to sit alongside the tier-tabs row instead of a standalone header
row.
- `OndoLeaderboardPosition`: new `showTitle` (default `false`) and
`computedAt` props — full leaderboard view opts in to a header with a
"last updated" timestamp.
- `OndoPortfolio`: skeleton now shows when loading with an empty
positions array (not just when portfolio is `null`).
- `CampaignTile`: Enter Now badge is gated behind
`isOptinAllowed(campaign)` so it disappears once the deposit cutoff has
passed.
- `useGetOndoLeaderboard` is now called unconditionally with
`campaignId` instead of a computed conditional ID, since all render
paths need leaderboard data.
## **Changelog**
CHANGELOG entry: null
## **Screenshots/Recordings**
Phase 1 - Opt in guidance
<img width="1444" height="132" alt="image"
src="https://github.com/user-attachments/assets/78fff8c4-ea9b-4292-9876-1f80c66b29ad"
/>
<img width="722" height="1229" alt="image"
src="https://github.com/user-attachments/assets/e36e6278-baa4-47f4-8477-ec92c58f5288"
/>
---
Phase 1 - Opted in & Position Guidance & Leaderboard
<img width="1585" height="210" alt="image"
src="https://github.com/user-attachments/assets/d5c58171-9933-4485-89f3-f9832b2d16f4"
/>
<img width="947" height="1774" alt="Screenshot from 2026-03-30 14-46-51"
src="https://github.com/user-attachments/assets/84792f98-96b5-476f-8c2c-2c409cd86260"
/>
---
Phase 1 - Opted in & at least one position
<img width="1585" height="246" alt="image"
src="https://github.com/user-attachments/assets/9026da48-ee64-4ea0-8d2c-78d42802da3d"
/>
<img width="934" height="1778" alt="Screenshot from 2026-03-30 14-35-38"
src="https://github.com/user-attachments/assets/c4c7a81e-ad75-435f-8f60-8db979f282d4"
/>
---
Phase 2 - Not Opted in & cut off date reached
<img width="1203" height="244" alt="image"
src="https://github.com/user-attachments/assets/3e52588d-2f4a-4e89-a824-f494612442f5"
/>
<img width="934" height="1778" alt="Screenshot from 2026-03-30 14-41-17"
src="https://github.com/user-attachments/assets/6103fd3a-9372-4fa7-becb-f9392517a780"
/>
---
Phase 2 - Opted in & cut off date reached & No positions
<img width="1523" height="398" alt="image"
src="https://github.com/user-attachments/assets/22bddf1b-7db4-4e26-86a1-03c046ca8912"
/>
<img width="934" height="1778" alt="Screenshot from 2026-03-30 14-41-17"
src="https://github.com/user-attachments/assets/6103fd3a-9372-4fa7-becb-f9392517a780"
/>
---
Phase 2 - Opted in & cut off date reached & positions
<img width="934" height="1778" alt="Screenshot from 2026-03-30 14-35-38"
src="https://github.com/user-attachments/assets/c4c7a81e-ad75-435f-8f60-8db979f282d4"
/>
---
Completed - Not opted in or opted in and no positions
<img width="1523" height="240" alt="image"
src="https://github.com/user-attachments/assets/db179fdb-2e0e-4902-a5bf-80be2a7305c8"
/>
<img width="941" height="1811" alt="Screenshot from 2026-03-30 13-39-10"
src="https://github.com/user-attachments/assets/bcfad4e3-1dca-47ce-8ad6-e9a83ec69fbd"
/>
---
Completed - opted in and at least one position
<img width="1444" height="298" alt="image"
src="https://github.com/user-attachments/assets/41cb2e04-ca8a-4157-b3c5-5b3e0c9b7e9f"
/>
<img width="941" height="1811" alt="Screenshot from 2026-03-30 13-50-02"
src="https://github.com/user-attachments/assets/71652bc4-f6cb-477f-bfe7-60d2fc236449"
/>
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Medium Risk**
> Refactors the Ondo rewards screens’ section-gating and data-fetch
paths (leaderboard/portfolio/position), which can affect what users see
and when network calls happen, but does not touch auth or core
transaction flows.
>
> **Overview**
> Improves Ondo rewards screens by **lifting
`useGetOndoPortfolioPosition` and `useGetOndoLeaderboardPosition` calls
into the parent views** and passing data/loading/error state down into
`OndoPortfolio` and `OndoLeaderboardPosition`, removing their internal
hook/selector coupling.
>
> `OndoCampaignDetailsView` now computes a single set of boolean flags
to control *How it works*, portfolio, leaderboard, and position
sections, replaces the old entries-closed banner with a unified
`RewardsInfoBanner`, and fetches leaderboard data unconditionally for
the campaign. `OndoLeaderboardView` similarly wires in the position hook
and renders leaderboard/position components without duplicated titles.
>
> UI behavior tweaks: `CampaignTile` hides the “Enter now” label when
opt-in is closed, `OndoLeaderboard` adds `showTitle` and adjusts where
the “updated at” timestamp renders (including single-tier), and
`OndoPortfolio` shows a skeleton when loading with an empty positions
array. Copy updates add new competition-closed strings and rename the
portfolio title in `en.json`.
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
9477e99. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
---------
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>1 parent 3f3d69b commit 340209c
15 files changed
Lines changed: 729 additions & 594 deletions
File tree
- app/components/UI/Rewards
- Views
- components/Campaigns
- hooks
- locales/languages
Lines changed: 85 additions & 14 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
| 15 | + | |
14 | 16 | | |
15 | 17 | | |
16 | 18 | | |
| |||
164 | 166 | | |
165 | 167 | | |
166 | 168 | | |
167 | | - | |
| 169 | + | |
168 | 170 | | |
169 | 171 | | |
170 | 172 | | |
171 | 173 | | |
172 | 174 | | |
173 | 175 | | |
174 | | - | |
| 176 | + | |
175 | 177 | | |
176 | 178 | | |
177 | 179 | | |
| |||
236 | 238 | | |
237 | 239 | | |
238 | 240 | | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
239 | 253 | | |
240 | 254 | | |
241 | 255 | | |
242 | 256 | | |
243 | 257 | | |
244 | 258 | | |
245 | 259 | | |
246 | | - | |
247 | | - | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
248 | 264 | | |
249 | 265 | | |
250 | 266 | | |
| |||
307 | 323 | | |
308 | 324 | | |
309 | 325 | | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
310 | 340 | | |
311 | 341 | | |
312 | 342 | | |
| |||
463 | 493 | | |
464 | 494 | | |
465 | 495 | | |
466 | | - | |
| 496 | + | |
467 | 497 | | |
468 | 498 | | |
469 | 499 | | |
| |||
474 | 504 | | |
475 | 505 | | |
476 | 506 | | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
477 | 514 | | |
478 | 515 | | |
479 | 516 | | |
| |||
620 | 657 | | |
621 | 658 | | |
622 | 659 | | |
623 | | - | |
| 660 | + | |
624 | 661 | | |
625 | 662 | | |
626 | 663 | | |
| |||
634 | 671 | | |
635 | 672 | | |
636 | 673 | | |
637 | | - | |
| 674 | + | |
| 675 | + | |
| 676 | + | |
| 677 | + | |
| 678 | + | |
| 679 | + | |
| 680 | + | |
| 681 | + | |
| 682 | + | |
| 683 | + | |
| 684 | + | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
| 690 | + | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
638 | 694 | | |
639 | 695 | | |
640 | 696 | | |
| |||
643 | 699 | | |
644 | 700 | | |
645 | 701 | | |
646 | | - | |
| 702 | + | |
647 | 703 | | |
648 | 704 | | |
649 | | - | |
| 705 | + | |
650 | 706 | | |
651 | 707 | | |
652 | 708 | | |
| |||
664 | 720 | | |
665 | 721 | | |
666 | 722 | | |
| 723 | + | |
667 | 724 | | |
668 | | - | |
| 725 | + | |
669 | 726 | | |
670 | 727 | | |
671 | | - | |
| 728 | + | |
672 | 729 | | |
673 | 730 | | |
674 | 731 | | |
| |||
687 | 744 | | |
688 | 745 | | |
689 | 746 | | |
690 | | - | |
| 747 | + | |
691 | 748 | | |
692 | 749 | | |
693 | 750 | | |
694 | 751 | | |
695 | | - | |
| 752 | + | |
696 | 753 | | |
697 | 754 | | |
698 | 755 | | |
| |||
703 | 760 | | |
704 | 761 | | |
705 | 762 | | |
| 763 | + | |
| 764 | + | |
| 765 | + | |
| 766 | + | |
| 767 | + | |
| 768 | + | |
| 769 | + | |
706 | 770 | | |
707 | 771 | | |
708 | 772 | | |
| |||
808 | 872 | | |
809 | 873 | | |
810 | 874 | | |
811 | | - | |
| 875 | + | |
812 | 876 | | |
813 | 877 | | |
814 | 878 | | |
| |||
819 | 883 | | |
820 | 884 | | |
821 | 885 | | |
| 886 | + | |
| 887 | + | |
| 888 | + | |
| 889 | + | |
| 890 | + | |
| 891 | + | |
| 892 | + | |
822 | 893 | | |
823 | 894 | | |
824 | 895 | | |
| |||
0 commit comments