Skip to content

fix(predict): group new sport types on outcome tabs#31578

Closed
caieu wants to merge 21 commits into
mainfrom
predict/PRED-957-corners-team-totals-and-first-half-team-totals-not-showing-up-correctly
Closed

fix(predict): group new sport types on outcome tabs#31578
caieu wants to merge 21 commits into
mainfrom
predict/PRED-957-corners-team-totals-and-first-half-team-totals-not-showing-up-correctly

Conversation

@caieu

@caieu caieu commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Description

Predict sports game-detail screens had two related problems: newer Polymarket sports market types were grouped into the wrong tabs/cards, and the rendering logic for those cards lived in the screen component, which made behavior harder to extend and test.

Reason for the change

Before these changes:

  • Soccer markets such as corners, team totals, half-time markets, and player props were not consistently mapped into the correct tabs/cards.
  • Moneyline-like markets could render with raw question text instead of a stable market label, and neutral outcomes such as Draw / Neither were not always positioned correctly.
  • Tennis first-set markets were not grouped separately from match-level markets.
  • Unsupported Polymarket market types could still flow into grouping logic and produce noisy or incorrect tabs.
  • Outcome groups were built for every parsed sports event (feed, search, carousel, etc.), even though only the detail view consumes them.
  • The game-details screen owned too much outcome rendering logic, which made live-price wiring, sticky tab/chip layout behavior, and targeted testing harder to maintain.

Solution

This branch moves tab/card shaping closer to the data model, gates grouping to detail-only code paths, and simplifies the UI rendering path.

Provider / grouping

  • Consolidated sports grouping constants into constants/sports.ts (SPORTS_MARKET_TYPE_TO_GROUP, GROUP_ORDER, priorities, moneyline/player-prop helpers).
  • getSportsMarketTypeGroupKey maps market types to tabs, including player-prop tabs derived from *_player_* types (e.g. soccer_player_shots_on_targetShots on Target).
  • buildOutcomeGroups now builds a full tab → card hierarchy via getOutcomeSubject and buildCardsForType:
    • per-team totals/corners → one card per team;
    • player props → one card per player;
    • game totals/corners → single aggregate line card;
    • exact score / discrete markets → one card per outcome;
    • moneyline/spread markets → single aggregate card.
  • Subgroup title on PredictOutcomeGroup carries provider-supplied card labels (e.g. Mexico Totals).
  • Added SUPPORTED_SPORTS_MARKET_TYPES allowlist; filterSupportedSportsOutcomes drops unsupported types from detail tabs (with one-time dev logging).
  • Added includeOutcomeGroups opt-in to parsePolymarketEvents so outcome groups are only built for market-detail and series-resolution calls, not feed/list/search/carousel parsing.

UI

  • PredictGameDetailsOutcomesList owns scroll, pull-to-refresh, and sticky tab/chip headers.
  • PredictGameOutcomeCard handles simple, line-based, and moneyline-style cards.
  • usePredictGameOutcomeRows derives card models plus token ids for live pricing.
  • PredictGameOutcomesTab is slimmed to map models → cards with a single useLiveMarketPrices subscription per active chip.
  • Moneyline cards center Draw/Neither; line cards default to the highest-volume line; PredictBetButton allows two-line labels.

Labels / i18n

  • Expanded en.json, readableMarketLabel, and missing-i18n handling for newly supported types.
  • Added moneyline-like types (soccer_first_to_score, soccer_second_half_result) and player-prop tab coverage (Goals, Assists, Shots, Goalscorers, Goals + Assists, Shots on Target, Saves).

Tests

  • Regression tests for provider grouping, supported-type filtering, card-model generation, card rendering, and the outcomes list/tab flow.

Changelog

CHANGELOG entry: null

Related issues

Fixes: PRED-957

Manual testing steps

Feature: Predict sports game-detail outcome grouping

  Background:
    Given the Predict extended sports markets feature is enabled

  Scenario: Corners render as a single line card
    Given I open a World Cup soccer game detail (e.g. "Mexico vs. South Africa")
    When I select the "Corners" tab
    Then the total corners market is a single card with an Over/Under line selector (8.5 / 9.5 / 10.5 / 11.5)
    And "Mexico Corners" and "South Africa Corners" appear as their own per-team cards

  Scenario: Team totals split per team
    Given I open a World Cup soccer game detail
    When I view the "Game Lines" tab
    Then I see a "Mexico Totals" card and a "South Africa Totals" card
    And each has its own line selector (no duplicated line values)

  Scenario: Half markets have their own tabs
    Given I open a World Cup soccer game detail
    Then a "1st Half" and a "2nd Half" tab are shown
    And first/second-half totals, team totals, and both-teams-to-score appear in those tabs (not in Game Lines)

  Scenario: Player props have their own tabs and split per player
    Given I open a World Cup soccer game detail
    When I select "Goals", "Assists", "Shots", "Goalscorers", "Goals + Assists", "Shots on Target", or "Saves"
    Then each player is its own card with an Over/Under line selector
    And no single card mixes multiple players

  Scenario: First Team to Score renders like a moneyline
    Given I open a World Cup soccer game detail
    When I view the "Game Lines" tab
    Then "First Team to Score" is one card with three buttons (MEX, NEITHER, RSA)
    And NEITHER is centered and its label is not truncated

  Scenario: Two-way moneyline label
    Given I open a tennis or baseball game detail
    Then the moneyline card is titled "Moneyline" (not the raw market question)

  Scenario: Tennis first-set markets have their own tab
    Given I open a tennis match detail
    Then a "1st Set" tab is shown
    And "1st Set Winner" and "1st Set Total Games" render under that tab (not under Game Lines)

  Scenario: Unsupported market types are hidden
    Given a game includes Polymarket market types outside the supported allowlist
    Then those outcomes do not appear as tabs or cards on the game-detail screen

Screenshots/Recordings

Before

Screen.Recording.2026-06-11.at.12.32.17.mov

After

Screen.Recording.2026-06-11.at.12.30.34.mov

Pre-merge author checklist

Performance checks (if applicable)

  • I've tested on Android
    • Ideally on a mid-range device; emulator is acceptable
  • I've tested with a power user scenario
    • Use these power-user SRPs to import wallets with many accounts and tokens
  • I've instrumented key operations with Sentry traces for production performance metrics

For performance guidelines and tooling, see the Performance Guide.

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.

@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.

@github-actions github-actions Bot added the pr-not-ready-for-e2e Skip E2E and block merging. Remove this label once the PR is ready to run the E2E tests. label Jun 11, 2026
@mm-token-exchange-service mm-token-exchange-service Bot added the team-predict Predict team label Jun 11, 2026
@caieu caieu changed the title Predict/pred 957 corners team totals and first half team totals not showing up correctly fix(predict): group new sport types on outcome tabs Jun 11, 2026
@caieu caieu marked this pull request as ready for review June 11, 2026 23:15
@caieu caieu requested a review from a team as a code owner June 11, 2026 23:15
@github-actions github-actions Bot added the risk:low AI analysis: low risk label Jun 11, 2026
@caieu caieu removed the pr-not-ready-for-e2e Skip E2E and block merging. Remove this label once the PR is ready to run the E2E tests. label Jun 12, 2026
@caieu caieu force-pushed the predict/PRED-957-corners-team-totals-and-first-half-team-totals-not-showing-up-correctly branch from b82963f to 401268d Compare June 12, 2026 18:56
@caieu caieu force-pushed the predict/PRED-957-corners-team-totals-and-first-half-team-totals-not-showing-up-correctly branch from 401268d to 10d396c Compare June 12, 2026 20:59
@caieu caieu changed the title fix(predict): group new sport types on outcome tabs fix(predict): group new sport types on outcome tabs cp-7.82.0 Jun 12, 2026
@github-actions github-actions Bot added risk:high AI analysis: high risk and removed risk:low AI analysis: low risk labels Jun 14, 2026
@github-actions github-actions Bot added risk:medium AI analysis: medium risk and removed risk:high AI analysis: high risk labels Jun 14, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🔍 Smart E2E Test Selection

  • Selected E2E tags: SmokePredictions, SmokeWalletPlatform, SmokeConfirmations
  • Selected Performance tags: @PerformancePredict
  • Risk Level: medium
  • AI Confidence: 88%
click to see 🤖 AI reasoning details

E2E Test Selection:
All 21 changed files are within the Predict/Polymarket feature area (app/components/UI/Predict/) plus localization strings (en.json). The changes are a significant refactor of the sports market outcome grouping and card hierarchy for the Predict market details view:

  1. New components: PredictGameOutcomeCard.tsx (new card rendering component), usePredictGameOutcomeRows.ts (new hook for building card models), readableMarketLabel.ts (new utility)
  2. Refactored: PredictGameOutcomesTab.tsx (major refactor - moved card logic to new components), constants/sports.ts (moved SPORTS_MARKET_TYPE_TO_GROUP, GROUP_ORDER, SPORTS_MARKET_TYPE_PRIORITIES from polymarket/constants.ts, added new market types), providers/polymarket/utils.ts (new outcome filtering/grouping logic, new buildCardsForType function, opt-in includeOutcomeGroups flag)
  3. UI change: PredictBetButton.tsx - numberOfLines changed from 1 to 2 (affects button label display)
  4. Localization: en.json - Added new sports market type translations for Predict (second_half, soccer player props, corners, etc.)

SmokePredictions: Directly affected - the Predict market details view, outcome cards, sports market grouping/filtering are all changed. This is the primary tag.
SmokeWalletPlatform: Per SmokePredictions tag description, 'Predictions is also a section inside the Trending tab (SmokeWalletPlatform); changes to Predictions views affect Trending.'
SmokeConfirmations: Per SmokePredictions tag description, 'opening/closing positions are on-chain transactions' - should be included when selecting SmokePredictions.

The changes are isolated to the Predict feature and don't touch shared infrastructure, navigation, or other wallet flows.

Performance Test Selection:
The @PerformancePredict tag covers prediction market list loading, market details, deposit flows, and balance display. The changes significantly refactor the market details view's outcome card rendering (new PredictGameOutcomeCard component, new usePredictGameOutcomeRows hook, new buildCardsForType logic). The new outcome filtering (filterSupportedSportsOutcomes) and card model building (buildOutcomeCardModels) add computation to the market details rendering path. The opt-in includeOutcomeGroups flag in parsePolymarketEvents also changes when outcome groups are built. These changes could impact the rendering performance of the market details screen, making @PerformancePredict relevant.

View GitHub Actions results

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 83.33333% with 54 lines in your changes missing coverage. Please review.
✅ Project coverage is 83.25%. Comparing base (6a6a037) to head (4a5fd89).
⚠️ Report is 60 commits behind head on main.

Files with missing lines Patch % Lines
...edictGameDetailsContent/PredictGameOutcomeCard.tsx 73.28% 11 Missing and 24 partials ⚠️
...ictGameDetailsContent/usePredictGameOutcomeRows.ts 85.07% 2 Missing and 8 partials ⚠️
...omponents/UI/Predict/providers/polymarket/utils.ts 92.94% 0 Missing and 6 partials ⚠️
app/components/UI/Predict/constants/sports.ts 90.90% 1 Missing and 1 partial ⚠️
...components/UI/Predict/utils/readableMarketLabel.ts 92.85% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #31578      +/-   ##
==========================================
- Coverage   83.25%   83.25%   -0.01%     
==========================================
  Files        5745     5748       +3     
  Lines      148745   148895     +150     
  Branches    34725    34772      +47     
==========================================
+ Hits       123833   123957     +124     
- Misses      16579    16582       +3     
- Partials     8333     8356      +23     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions

Copy link
Copy Markdown
Contributor

⚡ Performance Test Results

ℹ️ Performance test results are currently non-blocking and will not block this PR.

1 test failed · 3 tests · 1 device

📱 Devices tested (1)

Android: Google Pixel 8 Pro (v14.0)

❌ Failed Tests (1)

@team-predict

Test Platform Device Reason Recording
Predict Deposit - Complete Flow Performance Android Google Pixel 8 Pro (v14.0) Test error 📹 Watch
✅ Passed Tests (2)
Test Platform Device Duration Team Recording
Predict Available Balance - Complete Flow Performance Android Google Pixel 8 Pro (v14.0) 1.19s @team-predict 📹 Watch
Predict Market Details - Complete Flow Performance Android Google Pixel 8 Pro (v14.0) 0.00s @team-predict 📹 Watch

Branch: predict/PRED-957-corners-team-totals-and-first-half-team-totals-not-showing-up-correctly · Build: Normal · Commit: 9cd3c0d · View full run

@caieu caieu changed the title fix(predict): group new sport types on outcome tabs cp-7.82.0 fix(predict): group new sport types on outcome tabs Jun 16, 2026
@caieu caieu closed this Jun 16, 2026
@github-actions github-actions Bot locked and limited conversation to collaborators Jun 16, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

risk:medium AI analysis: medium risk size-XL team-predict Predict team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants