Commit c15e817
chore(runway): cherry-pick fix(predict): cp-7.62.0 display user positions in sport market cards (#24895)
- fix(predict): cp-7.62.0 display user positions in sport market cards
(#24853)
## **Description**
This PR integrates user positions into `PredictMarketSportCard` with
conditional rendering of action buttons based on position state.
**Problem**: Sport market cards always showed bet buttons regardless of
whether the user had open positions.
**Solution**: Created a new `PredictSportCardFooter` component that:
- Fetches positions via `usePredictPositions`
- Shows skeleton loader while positions are loading (prevents flash of
bet buttons → picks)
- Conditionally renders UI based on market status and positions:
| Market Status | Positions | Rendered UI |
|---------------|-----------|-------------|
| `open` | None | Bet buttons |
| `open` | Has open positions | Positions only (no buttons) |
| `closed` | Any | Positions only (if any) |
| `resolved` | Has claimable positions | Positions + Claim button |
## **Changelog**
CHANGELOG entry: null
## **Related issues**
Fixes: https://consensyssoftware.atlassian.net/browse/PRED-492
## **Manual testing steps**
```gherkin
Feature: Sport Market Card Position Display
Scenario: user sees bet buttons when no positions exist
Given user has no positions on a sport market
When user views the sport market card
Then user sees Yes/No bet buttons
Scenario: user sees positions when they have open positions
Given user has open positions on a sport market
When user views the sport market card
Then user sees their positions displayed
And user does not see bet buttons
Scenario: user sees claim button when positions are claimable
Given user has claimable positions on a resolved sport market
When user views the sport market card
Then user sees their positions displayed
And user sees a Claim button with the claimable amount
Scenario: user sees skeleton while positions load
Given user opens the predict feed
When sport market cards are loading
Then user sees skeleton placeholders in card footers
And user does not see a flash of bet buttons
```
## **Screenshots/Recordings**
### **Before**
<!-- Cards always showed bet buttons, then flashed to positions when
loaded -->
### **After**
<!-- Cards show skeleton → then positions (or buttons if no positions)
-->
<img width="382" height="805" alt="Screenshot 2026-01-16 at 10 17 34 PM"
src="https://github.com/user-attachments/assets/4732657b-ccf5-4272-ae75-53dd9822d330"
/>
## **Pre-merge author checklist**
- [x] I've followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile
Coding
Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md).
- [x] I've completed the PR template to the best of my ability
- [x] I've included tests if applicable
- [x] I've documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [x] I've applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.
## **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.
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> Integrates position-aware footer into sport market cards and refines
picks rendering to avoid UI flash and enable claims.
>
> - Introduces `PredictSportCardFooter` used by `PredictMarketSportCard`
to: fetch positions (`usePredictPositions`), show a skeleton while
loading, and render `PredictPicksForCard`, bet buttons, or a claim
button based on market/position state; resolves `entryPoint` (overrides
with trending when applicable)
> - Removes inline action handling from `PredictMarketSportCard`;
delegates to `PredictSportCardFooter`
> - Enhances `PredictPicksForCard` to accept optional `positions`,
`showSeparator`, disable internal fetching when positions are provided,
return `null` when no positions, and display `currentValue` instead of
`amount`
> - Adds comprehensive tests for footer behavior, navigation/guarded
actions, claim flow, and updated picks behavior
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
c2516ae. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
[2a9d9ea](2a9d9ea)
Co-authored-by: Luis Taniça <matallui@gmail.com>1 parent 16dafe9 commit c15e817
7 files changed
Lines changed: 1235 additions & 150 deletions
File tree
- app/components/UI/Predict/components
- PredictMarketSportCard
- PredictPicks
Lines changed: 85 additions & 92 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
11 | 10 | | |
12 | 11 | | |
13 | 12 | | |
| |||
16 | 15 | | |
17 | 16 | | |
18 | 17 | | |
19 | | - | |
20 | 18 | | |
21 | 19 | | |
22 | 20 | | |
| |||
29 | 27 | | |
30 | 28 | | |
31 | 29 | | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | 30 | | |
65 | 31 | | |
66 | 32 | | |
| |||
87 | 53 | | |
88 | 54 | | |
89 | 55 | | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
90 | 78 | | |
91 | 79 | | |
92 | 80 | | |
| |||
154 | 142 | | |
155 | 143 | | |
156 | 144 | | |
157 | | - | |
158 | | - | |
159 | | - | |
160 | 145 | | |
161 | 146 | | |
162 | 147 | | |
| |||
176 | 161 | | |
177 | 162 | | |
178 | 163 | | |
179 | | - | |
180 | | - | |
181 | | - | |
182 | | - | |
183 | | - | |
184 | | - | |
185 | | - | |
186 | | - | |
187 | | - | |
188 | | - | |
189 | | - | |
190 | | - | |
191 | | - | |
192 | | - | |
193 | | - | |
194 | | - | |
195 | | - | |
196 | | - | |
197 | | - | |
198 | | - | |
199 | | - | |
200 | | - | |
201 | | - | |
202 | | - | |
203 | | - | |
204 | | - | |
205 | | - | |
206 | | - | |
207 | | - | |
208 | | - | |
209 | | - | |
210 | | - | |
211 | | - | |
212 | | - | |
213 | | - | |
214 | | - | |
215 | | - | |
216 | | - | |
217 | | - | |
218 | | - | |
219 | | - | |
220 | | - | |
221 | | - | |
222 | | - | |
223 | | - | |
224 | | - | |
225 | | - | |
226 | | - | |
227 | | - | |
228 | | - | |
229 | | - | |
230 | | - | |
231 | | - | |
232 | | - | |
233 | | - | |
234 | 164 | | |
235 | 165 | | |
236 | 166 | | |
| |||
431 | 361 | | |
432 | 362 | | |
433 | 363 | | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
434 | 427 | | |
Lines changed: 8 additions & 42 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
| 9 | + | |
10 | 10 | | |
11 | | - | |
12 | | - | |
13 | | - | |
14 | | - | |
| 11 | + | |
15 | 12 | | |
16 | 13 | | |
17 | 14 | | |
| |||
21 | 18 | | |
22 | 19 | | |
23 | 20 | | |
24 | | - | |
25 | | - | |
| 21 | + | |
26 | 22 | | |
27 | 23 | | |
28 | 24 | | |
| |||
44 | 40 | | |
45 | 41 | | |
46 | 42 | | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | 43 | | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | 44 | | |
76 | 45 | | |
77 | 46 | | |
| |||
110 | 79 | | |
111 | 80 | | |
112 | 81 | | |
113 | | - | |
114 | | - | |
115 | | - | |
116 | | - | |
117 | | - | |
118 | | - | |
119 | | - | |
120 | | - | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
121 | 87 | | |
122 | 88 | | |
123 | 89 | | |
| |||
0 commit comments