Skip to content

feat(rewards): show success toast on campaign opt-in and hide CTA while loading#28033

Merged
VGR-GIT merged 10 commits into
mainfrom
rwds-1101-show-toast-on-opt-in
Mar 27, 2026
Merged

feat(rewards): show success toast on campaign opt-in and hide CTA while loading#28033
VGR-GIT merged 10 commits into
mainfrom
rwds-1101-show-toast-on-opt-in

Conversation

@VGR-GIT

@VGR-GIT VGR-GIT commented Mar 27, 2026

Copy link
Copy Markdown
Contributor

Description

Shows a success toast ("You're in!") after a user successfully opts into a campaign via CampaignOptInSheet. Also hides the Join Campaign CTA entirely while participant status is loading (previously it rendered a disabled/loading button), and removes the skeleton loader from OndoCampaignDetailsView during that loading phase.

Jira: RWDS-1101

Changelog

CHANGELOG entry: Added a success confirmation toast when users opt in to a rewards campaign.

Related issues

Fixes: RWDS-1101

Screenshots/Recordings

image

Note

Low Risk
Low risk UI/UX behavior changes around opt-in feedback and CTA visibility, with minor logging/empty-state tweaks; main risk is unintended hiding of the join CTA during slow participant-status fetches.

Overview
Adds a success confirmation toast ("You're in!") after a campaign opt-in completes successfully in CampaignOptInSheet, only closing the sheet when the API reports optedIn: true.

Updates the campaign details/join flow to hide the "Join Campaign" CTA while participant status is loading (and removes the loading/skeleton CTA handling), with tests updated to reflect the new visibility rules.

Treats an Ondo portfolio with zero positions as an empty state (showing the empty banner instead of the container) and adds error logging when portfolio fetch fails; includes the new rewards.campaign.opt_in_success_toast i18n string.

Written by Cursor Bugbot for commit ee88724. This will update automatically on new commits. Configure here.

@github-actions

Copy link
Copy Markdown
Contributor

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.

sophieqgu and others added 8 commits March 27, 2026 13:12
https://consensyssoftware.atlassian.net/browse/RWDS-1109

- `CampaignEntriesClosedBanner` component shown when deposit cutoff date has passed
- Entries-closed toast notification via `useRewardsToast`

- `CampaignJoinCTA` hides the join button when opt-in is no longer allowed past cutoff date
- `useGetCampaignParticipantStatus` reflects cutoff-date awareness
- `OndoCampaignDetailsView` renders the entries-closed banner and leaderboard for campaigns past cutoff

<!-- Add screenshots here -->

Co-authored-by: VGR-GIT <vangulckrik@gmail.com>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
…larity

The variable canOptIn was true when opt-in was NOT allowed (entries closed),
making its name the exact opposite of its value. Renamed to areEntriesClosed
to match the actual semantics.

Also fixes a latent bug in leaderboardCampaignId: the original !canOptIn
evaluated to true when entries were still open, contradicting the documented
intent of enabling the leaderboard for "active campaign past cutoff date".
The fix uses areEntriesClosed directly so the leaderboard fetches correctly
when entries are closed.

Co-authored-by: VGR-GIT <vangulckrik@gmail.com>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Show CampaignHowItWorks when entries are still open (!areEntriesClosed),
not after they close. Fix the inverted condition in OndoCampaignDetailsView
and update the two affected test cases to match the correct behaviour.

Co-authored-by: VGR-GIT <vangulckrik@gmail.com>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
…le loading

- Show "You're in!" toast after successful opt-in via CampaignOptInSheet
- Hide CampaignJoinCTA entirely while participant status is loading instead of rendering a disabled/loading button
- Remove skeleton loader from OndoCampaignDetailsView during participant status load
- Add opt_in_success_toast locale string

Closes RWDS-1101

Co-authored-by: VGR-GIT <vangulckrik@gmail.com>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
@VGR-GIT VGR-GIT force-pushed the rwds-1101-show-toast-on-opt-in branch from 45be09e to b85003e Compare March 27, 2026 12:14
@VGR-GIT VGR-GIT marked this pull request as ready for review March 27, 2026 12:15
@VGR-GIT VGR-GIT requested a review from a team as a code owner March 27, 2026 12:15

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 3 potential issues.

Fix All in Cursor

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Comment thread app/components/UI/Rewards/components/Campaigns/CampaignJoinCTA.test.tsx Outdated
Comment thread app/components/UI/Rewards/Views/OndoCampaignDetailsView.test.tsx
Comment thread app/components/UI/Rewards/Views/OndoCampaignDetailsView.test.tsx
…mpaignJoinCTA

The entries closed toast describe block was testing toast behaviour that
does not exist in the component. Removed the block along with all
associated unused mocks (useRewardsToast, @react-navigation/native).

Co-authored-by: VGR-GIT <vangulckrik@gmail.com>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
@VGR-GIT VGR-GIT enabled auto-merge March 27, 2026 12:23
@metamaskbot metamaskbot added the INVALID-PR-TEMPLATE PR's body doesn't match template label Mar 27, 2026
@github-actions github-actions Bot added the risk-low Low testing needed · Low bug introduction risk label Mar 27, 2026
EugeniyBykov
EugeniyBykov previously approved these changes Mar 27, 2026
…lock

Log the error instead of silently ignoring it to satisfy SonarCloud S2486.

Co-authored-by: VGR-GIT <vangulckrik@gmail.com>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
@github-actions github-actions Bot added risk-low Low testing needed · Low bug introduction risk and removed risk-low Low testing needed · Low bug introduction risk labels Mar 27, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🔍 Smart E2E Test Selection

  • Selected E2E tags: None (no tests recommended)
  • Selected Performance tags: None (no tests recommended)
  • Risk Level: low
  • AI Confidence: 88%
click to see 🤖 AI reasoning details

E2E Test Selection:
The changes are entirely contained within the Rewards/Campaigns UI feature area:

  1. CampaignOptInSheet.tsx: Added success toast ("You're in!") after successful campaign opt-in. This is a UX improvement to the opt-in flow.
  2. CampaignJoinCTA.tsx: Changed loading behavior - CTA button is now hidden (returns null) while participant status is loading, instead of showing a disabled/loading button state.
  3. OndoCampaignDetailsView.tsx: Removed a loading skeleton that was shown during participant status loading (consistent with CTA change).
  4. OndoPortfolio.tsx: Fixed empty state condition to also show empty state when portfolio has zero positions (not just null portfolio).
  5. useGetOndoPortfolioPosition.ts: Added error logging (console.error) to catch block - purely diagnostic.
  6. en.json: Added new localization string opt_in_success_toast: "You're in!".

None of the available E2E test tags cover the Rewards/Ondo campaign feature. Searching confirmed there are no .e2e.ts or .e2e.js files referencing rewards or ondo functionality. The changes don't touch any shared infrastructure components (navigation, browser, confirmations, modals, account management, network management, etc.) that would affect other test suites. The Rewards feature is a standalone UI feature with its own isolated component tree. No performance-sensitive code paths are modified.

Performance Test Selection:
The changes are limited to Rewards/Campaigns UI components - adding a toast notification, adjusting loading state visibility, fixing an empty state condition, and adding error logging. None of these changes affect performance-sensitive paths like account list rendering, app startup, login flows, swap execution, or asset loading. No performance tests are warranted.

View GitHub Actions results

@sonarqubecloud

Copy link
Copy Markdown

@VGR-GIT VGR-GIT added this pull request to the merge queue Mar 27, 2026
Merged via the queue into main with commit 685d17c Mar 27, 2026
61 of 62 checks passed
@VGR-GIT VGR-GIT deleted the rwds-1101-show-toast-on-opt-in branch March 27, 2026 14:19
@github-actions github-actions Bot locked and limited conversation to collaborators Mar 27, 2026
@metamaskbot metamaskbot added the release-7.73.0 Issue or pull request that will be included in release 7.73.0 label Mar 27, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

INVALID-PR-TEMPLATE PR's body doesn't match template release-7.73.0 Issue or pull request that will be included in release 7.73.0 risk-low Low testing needed · Low bug introduction risk size-M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants