Skip to content

fix(predict): update sports moneyline detail actions cp-7.80.0#31034

Merged
matallui merged 4 commits into
mainfrom
predict/pred-949
Jun 3, 2026
Merged

fix(predict): update sports moneyline detail actions cp-7.80.0#31034
matallui merged 4 commits into
mainfrom
predict/pred-949

Conversation

@matallui

@matallui matallui commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

Description

Fixes Predict detail screens for sports markets with extended sports markets enabled:

  • Adds proper spacing between moneyline button labels and prices.
  • Uses live market prices for moneyline buttons in the Game Lines/Halftime outcome cards.
  • Hides the redundant static prediction footer when extended outcome cards are available, while preserving claim actions for claimable winnings.

Changelog

CHANGELOG entry: null

Related issues

Fixes: PRED-949

Manual testing steps

Feature: Predict sports market detail actions

  Scenario: user views an extended sports market detail screen
    Given predictExtendedSportsMarkets is enabled for the sports league
    And the user opens a sports market detail screen with moneyline outcomes

    When live prices update for the Game Lines moneyline outcomes
    Then the moneyline buttons show labels and prices with spacing
    And the moneyline button prices match the live prices
    And the static prediction footer is not shown

Screenshots/Recordings

Before

Simulator Screenshot - mm-blue - 2026-06-03 at 11 11 49

After

simulator_screenshot_B8780C21-F06F-49C9-A690-B778D96AFCF0

Pre-merge author checklist

Performance checks (if applicable)

Not applicable; UI rendering/state wiring change only.

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

Note

Low Risk
UI-only Predict sports detail changes with tests; live price wiring reuses existing hooks and the same validity rules as other buy flows.

Overview
Improves extended sports game detail screens: moneyline outcome cards now show live best-ask prices (with static token price fallback), use an inline button layout for clearer label/price spacing, and the static prediction footer is hidden when extended outcome groups are shown—claim actions still show when there are claimable winnings.

Also tightens scoreboard horizontal spacing (score padding; row gap cleanup) and exports isValidPrice for reuse in outcome pricing. Tests cover footer visibility, live pricing, and layout expectations.

Reviewed by Cursor Bugbot for commit a084399. Bugbot is set up for automated code reviews on this repo. Configure here.

@github-actions

github-actions Bot commented Jun 3, 2026

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.

@mm-token-exchange-service mm-token-exchange-service Bot added the team-predict Predict team label Jun 3, 2026
@matallui matallui changed the title fix: update sports moneyline detail actions fix(predict): update sports moneyline detail actions cp-7.80.0 Jun 3, 2026
@github-actions github-actions Bot added the size-M label Jun 3, 2026
@matallui matallui marked this pull request as ready for review June 3, 2026 18:35
@matallui matallui requested a review from a team as a code owner June 3, 2026 18:35
@github-actions github-actions Bot added the risk:low AI analysis: low risk label Jun 3, 2026
@MarioAslau

Copy link
Copy Markdown
Contributor

Medium severity

M1 — ?? yesToken.price does not fall back when bestAsk is 0

PredictGameOutcomesTab.tsx (buildMoneylineButtons):

const price = getPrice?.(yesToken.id)?.bestAsk ?? yesToken.price;

?? only falls back on null/undefined. The WebSocket layer emits bestAsk as parseFloat(change.best_ask) || 0 (WebSocketManager.ts:735), so an illiquid market / missing ask side yields bestAsk === 0, which passes through ?? and renders the button as instead of falling back to the static token price.

The repo already solves this exact precedence with a validity guard (price > 0):

// utils/prices.ts
const isValidPrice = (price) => typeof price === 'number' && Number.isFinite(price) && price > 0;
// getPredictBuyPrice: live bestAsk > REST buy > base price

Recommend reusing isValidPrice/getPredictBuyPrice (or at least guarding bestAsk > 0) rather than re-implementing price selection inline with ??.

M2 — Hiding the footer removes the only entry point to the market "About" / info sheet

In PredictGameDetailsContent.tsx, handleInfoPress (which opens PredictGameAboutSheet with the market description) is passed only to PredictGameDetailsFooter via onInfoPress. The new logic:

const hasExtendedOutcomes = tabsEnabled && groupMap.size > 0;
const showFooter = !hasExtendedOutcomes || (claimableAmount > 0 && Boolean(onClaimPress));

means that for an extended sports market without claimable winnings the footer is hidden, and PredictGameDetailsTabsContent exposes no info button (it only wires onBetPress). Net effect: the market description / About sheet becomes unreachable in that state — a functional regression. If this is intentional, consider relocating the info affordance into the tabs/scoreboard header; otherwise the about-sheet trigger is lost.

M3 — Scoreboard spacing regression when scores are hidden (scheduled games)

PredictSportScoreboard.tsx removed the row gap and moved spacing onto the score Text elements:

- twClassName={compact ? 'w-full gap-2' : 'w-full gap-3'}
+ twClassName="w-full"
...
- twClassName={scoreWidthClass}
+ twClassName={`${scoreWidthClass} ${compact ? 'pl-2' : 'pl-3'}`}

The pl-*/pr-* padding lives on the score texts, which are rendered only when showScores is true. For scheduled/upcoming games (showScores === false), the scores aren't rendered, so with the row gap now gone there is no spacing at all between the team logos and the center status block — they sit flush. Worth verifying the scheduled-state layout against the live/score state (the screenshots only show a scored game).

caieu
caieu previously approved these changes Jun 3, 2026
@matallui

matallui commented Jun 3, 2026

Copy link
Copy Markdown
Contributor Author

M1 is fixed in a084399. The moneyline button price now uses the shared isValidPrice guard so live bestAsk must be finite and > 0 before overriding the static token price. Added coverage for bestAsk: 0 falling back to the token price.

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

LGTM

@github-actions

github-actions Bot commented Jun 3, 2026

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 7 changed files are within app/components/UI/Predict/ and affect the Predictions (Polymarket) feature:

  1. PredictGameDetailsContent.tsx: Conditionally hides the footer when extended sports markets are enabled (tabsEnabled + groupMap.size > 0), but keeps it for claimable winnings. This changes the UI flow for game details.

  2. PredictGameOutcomesTab.tsx: Integrates live market prices via useLiveMarketPrices hook for moneyline buttons, with fallback to static token price when live price is invalid (isValidPrice check). Also changes MoneylineCard buttonLayout from 'stacked' to 'inlineNoSeparator'.

  3. PredictSportOutcomeCard.tsx: Adds 'inlineNoSeparator' as a valid buttonLayout prop type to support the new layout.

  4. PredictSportScoreboard.tsx: Minor CSS layout tweaks — removes gap classes and adds padding-left/right to score elements for compact/non-compact modes.

  5. prices.ts: Exports isValidPrice function (previously unexported) for use in PredictGameOutcomesTab.

  6. Test files: Unit tests updated to cover new footer visibility logic and live price behavior.

Tags selected:

  • SmokePredictions: Directly affected — game details content, outcome cards, scoreboard, and live price display are all core Predictions UI components.
  • SmokeWalletPlatform: Per SmokePredictions tag description, Predictions is a section inside the Trending tab; changes to Predictions views affect Trending/SmokeWalletPlatform.
  • SmokeConfirmations: Per SmokePredictions tag description, opening/closing positions are on-chain transactions requiring confirmations.

Performance Test Selection:
The changes include UI rendering updates to PredictGameDetailsContent (conditional footer rendering), PredictGameOutcomesTab (live price integration with useLiveMarketPrices hook adding real-time data fetching), and PredictSportScoreboard (layout changes). The live price integration in particular adds a new data-fetching hook (useLiveMarketPrices) to the moneyline card rendering path, which could impact rendering performance for prediction market details. @PerformancePredict covers prediction market list loading, market details, deposit flows, and balance display — directly relevant to these changes.

View GitHub Actions results

@matallui matallui enabled auto-merge June 3, 2026 19:11
@matallui matallui added this pull request to the merge queue Jun 3, 2026
Merged via the queue into main with commit 9f88621 Jun 3, 2026
199 checks passed
@matallui matallui deleted the predict/pred-949 branch June 3, 2026 19:50
@github-actions github-actions Bot locked and limited conversation to collaborators Jun 3, 2026
@metamaskbotv2 metamaskbotv2 Bot added the release-7.81.0 Issue or pull request that will be included in release 7.81.0 label Jun 3, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

release-7.81.0 Issue or pull request that will be included in release 7.81.0 risk:low AI analysis: low risk size-M team-predict Predict team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants