refactor(rewards): lift portfolio and leaderboard position hook calls to parent views#28049
Conversation
… to parent views OndoPortfolio and OndoLeaderboardPosition previously called their data hooks internally, causing duplicate fetches when the parent view already needed the same data for visibility gating. Both components now receive hook result values as props, with the single fetch point living in OndoCampaignDetailsView (portfolio + leaderboard position) and OndoLeaderboardView (leaderboard position). Tests updated to pass props directly, removing the need to mock internal hooks. Co-authored-by: VGR-GIT <vangulckrik@gmail.com> Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
|
CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes. |
|
✅ E2E Fixture Validation — Schema is up to date |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #28049 +/- ##
==========================================
+ Coverage 82.61% 82.63% +0.01%
==========================================
Files 4849 4854 +5
Lines 124916 125065 +149
Branches 27873 27923 +50
==========================================
+ Hits 103199 103342 +143
+ Misses 14609 14605 -4
- Partials 7108 7118 +10 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
…details view - Replace CampaignEntriesClosedBanner with RewardsInfoBanner for competition-closed state - Always fetch leaderboard data (not conditionally) to support all render paths - Compute section visibility (showHowItWorksSection, showCompetitionEndedBanner, showLeaderboardSection, showLeaderboardPositionSection, showPortfolioSection) in a single useMemo for clearer logic - Add showTitle prop to OndoLeaderboard (default true) and OndoLeaderboardPosition (default false); move computedAt timestamp to sit alongside the tier tabs row - Show competition-ended banner for complete campaigns and for active campaigns past the deposit cutoff date - OndoPortfolio: show skeleton when loading with an empty positions array - CampaignTile: gate Enter Now CTA behind isOptinAllowed check - Update all associated tests to match new component contracts Co-authored-by: VGR-GIT <vangulckrik@gmail.com> Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
… loading The test expected the banner to appear while participant status was loading, but the component intentionally gates the banner behind !isParticipantStatusLoading. Updated the test description and assertion to match the correct behaviour. Co-authored-by: VGR-GIT <vangulckrik@gmail.com> Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
🔍 Smart E2E Test Selection
click to see 🤖 AI reasoning detailsE2E Test Selection:
No E2E tests exist for the Rewards/Ondo feature (confirmed by searching e2e/ and tests/ directories). The changes do not touch: Engine, controllers, navigation infrastructure, shared components (TabBar, modals, confirmations), or any other feature area. The Rewards feature is self-contained and not referenced by Trending or other tested components. Running any E2E test suite would not provide meaningful coverage for these changes, and no existing tests would be broken by them. Performance Test Selection: |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
|




Description
This PR refactors how
OndoCampaignDetailsViewdecides which sections to render, replacing ad-hoc inline conditions with a singleuseMemothat computes five boolean flags. It also replacesCampaignEntriesClosedBannerwithRewardsInfoBannerfor a unified visual treatment.Other changes
OndoLeaderboard: newshowTitleprop (defaulttrue) — parent can suppress the section title when rendering inline.computedAttimestamp moves to sit alongside the tier-tabs row instead of a standalone header row.OndoLeaderboardPosition: newshowTitle(defaultfalse) andcomputedAtprops — 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 isnull).CampaignTile: Enter Now badge is gated behindisOptinAllowed(campaign)so it disappears once the deposit cutoff has passed.useGetOndoLeaderboardis now called unconditionally withcampaignIdinstead of a computed conditional ID, since all render paths need leaderboard data.Changelog
CHANGELOG entry: null
Screenshots/Recordings
Phase 1 - Opt in guidance
Phase 1 - Opted in & Position Guidance & Leaderboard
Phase 1 - Opted in & at least one position
Phase 2 - Not Opted in & cut off date reached
Phase 2 - Opted in & cut off date reached & No positions
Phase 2 - Opted in & cut off date reached & positions
Completed - Not opted in or opted in and no positions
Completed - opted in and at least one position
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
useGetOndoPortfolioPositionanduseGetOndoLeaderboardPositioncalls into the parent views and passing data/loading/error state down intoOndoPortfolioandOndoLeaderboardPosition, removing their internal hook/selector coupling.OndoCampaignDetailsViewnow 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 unifiedRewardsInfoBanner, and fetches leaderboard data unconditionally for the campaign.OndoLeaderboardViewsimilarly wires in the position hook and renders leaderboard/position components without duplicated titles.UI behavior tweaks:
CampaignTilehides the “Enter now” label when opt-in is closed,OndoLeaderboardaddsshowTitleand adjusts where the “updated at” timestamp renders (including single-tier), andOndoPortfolioshows a skeleton when loading with an empty positions array. Copy updates add new competition-closed strings and rename the portfolio title inen.json.Written by Cursor Bugbot for commit 9477e99. This will update automatically on new commits. Configure here.