feat(predict): implement featured carousel#28102
Conversation
|
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. |
da5bd76 to
721740a
Compare
app/components/UI/Predict/components/FeaturedCarousel/FeaturedCarouselCard.utils.ts
Outdated
Show resolved
Hide resolved
app/components/UI/Predict/components/FeaturedCarousel/FeaturedCarouselSportCard.tsx
Outdated
Show resolved
Hide resolved
app/components/UI/Predict/components/FeaturedCarousel/FeaturedCarouselCard.utils.ts
Outdated
Show resolved
Hide resolved
app/components/UI/Predict/components/FeaturedCarousel/FeaturedCarousel.tsx
Show resolved
Hide resolved
app/components/UI/Predict/components/FeaturedCarousel/FeaturedCarouselCard.tsx
Show resolved
Hide resolved
| @@ -0,0 +1,21 @@ | |||
| import { StyleSheet } from 'react-native'; | |||
There was a problem hiding this comment.
Why use StyleSheet? I believe this is against the UI guidelines.
There was a problem hiding this comment.
This is from bringing over some of my system prompts/skills from extension dev env. Switched to tw and removed those so it shouldn't occur again
| export const useFeaturedCarouselData = (): UseFeaturedCarouselDataResult => { | ||
| const [markets, setMarkets] = useState<PredictMarket[]>([]); | ||
| const [isLoading, setIsLoading] = useState(true); | ||
| const [error, setError] = useState<string | null>(null); |
There was a problem hiding this comment.
Let's use React Query for this. We are in the process of transitioning all of our queries to RQ, so some hooks might not have it yet, but all new hooks should use it. Take a look at other queries under queries/
There was a problem hiding this comment.
Done! Will use from now on.
| if (liveSportsEnabled) { | ||
| const neededTeams = extractNeededTeamsFromEvents( | ||
| events, | ||
| supportedLeagues, | ||
| ); | ||
|
|
||
| await Promise.all( | ||
| [...neededTeams.entries()].map(([league, abbreviations]) => | ||
| TeamsCache.getInstance().ensureTeamsLoaded(league, abbreviations), | ||
| ), | ||
| ); | ||
| } |
There was a problem hiding this comment.
I wonder if we could extract this logic out of here, since it seems we are repeating it in a few places now.
There was a problem hiding this comment.
Done! Great suggestion, let me know what you think
| /** League logo URL for carousel/card headers. If omitted, no logo is shown. */ | ||
| leagueLogo?: string; |
There was a problem hiding this comment.
Why the need for this here? I would only add this here once we have the need to override the logo for certain leagues, otherwise we keep the default behavior (which should use the data from the API)
There was a problem hiding this comment.
The Figma had some logos that I didn't recognize from the codebase, so added this here to future proof it. I agree though, I will cut it to simplify and can always add it back (or similar) later. The current code fetches from the API.
… Query, dedup team loading, remove unused leagueLogo
app/components/UI/Predict/components/FeaturedCarousel/FeaturedCarousel.tsx
Show resolved
Hide resolved
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
There are 2 total unresolved issues (including 1 from previous review).
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 269d36c. Configure here.
app/components/UI/Predict/components/FeaturedCarousel/FeaturedCarouselSportCard.tsx
Show resolved
Hide resolved
🔍 Smart E2E Test Selection
click to see 🤖 AI reasoning detailsE2E Test Selection:
SmokePredictions: Directly required - the PredictFeed view is modified with a new carousel component, PredictController is extended, and the Polymarket provider has new functionality. E2E tests should verify the Predictions feature still works correctly (positions, balance, activities). SmokeWalletPlatform: Required per tag description - Predictions is a section inside the Trending tab, and changes to Predictions views affect Trending/SmokeWalletPlatform. SmokeConfirmations: Required per SmokePredictions tag description - opening/closing positions are on-chain transactions requiring confirmations. The feature flag is disabled by default in prod, so the carousel won't be visible in standard E2E tests, but the underlying PredictFeed modifications and provider changes still need validation to ensure existing flows aren't broken. Performance Test Selection: |
|
✅ E2E Fixture Validation — Schema is up to date |
|




Description
Adds a horizontally-scrollable featured carousel to the top of the Predict feed. The carousel is populated from Polymarket's homepage carousel API (
polymarket.com/api/homepage/carousel), which returns their curated high-engagement markets — politics, sports, crypto, etc.Two card variants:
$100 → $159.98), percentage CTA buttons, and a footer with remaining outcomes count + end date + volume.isDrawCapableLeague), and footer with time remaining + volume.The carousel is gated behind a
predictFeaturedCarouselremote feature flag (version-gated, defaults tofalse). When enabled, it renders between the balance header and the tab bar in the Predict feed.The carousel API returns
outcomes,outcomePrices, andclobTokenIdsas native arrays (unlike the gamma API which returns them as JSON strings), so the fetch layer normalizes them to strings before passing to the existingparsePolymarketEventsparser.Data flow follows existing patterns:
useFeaturedCarouselData→PredictController.getCarouselMarkets()→PolymarketProvider.getCarouselMarkets()→fetchCarouselFromPolymarketApi()with full team loading,TeamsCache, andGameCache.overlayOnMarkets().Changelog
CHANGELOG entry: Added featured carousel to the top of the Predict feed showing curated markets from Polymarket
Related issues
Fixes: https://consensyssoftware.atlassian.net/browse/PRED-533
Manual testing steps
Screenshots/Recordings
Before
After
demopredictcarousel.mov
Pre-merge author checklist
Pre-merge reviewer checklist
Note
Medium Risk
Adds a new feed surface plus a new provider/controller fetch path hitting an external endpoint and normalizing/deriving sports data, which could impact feed performance and correctness if API responses change. Feature-flag gating and extensive tests reduce rollout risk.
Overview
Adds a new featured carousel section to the top of the Predict feed (behind the remote flag
predictTabFeaturedCarousel), rendering a horizontally snapping list with pagination dots and skeleton loading.Introduces two new card variants (
FeaturedCarouselCardandFeaturedCarouselSportCard) with buy CTAs that route through existing guarded navigation to market details and buy preview, plus shared footer/payout formatting utilities.Wires a new data path
useFeaturedCarouselData→ React QueryfeaturedCarouselquery →PredictController.getCarouselMarkets()→ providergetCarouselMarkets(); implements Polymarket support by calling the homepage carousel endpoint, normalizing array fields (outcomes,outcomePrices,clobTokenIds) to the parser’s expected format, filtering invalid markets, and reusing Teams/Game cache overlays when live sports is enabled. Adds comprehensive unit tests across UI, hooks, controller, provider, and utils.Reviewed by Cursor Bugbot for commit a15d264. Bugbot is set up for automated code reviews on this repo. Configure here.