chore(predict): build predict portfolio module and shared portfolio UI components#30679
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. |
Medium severity1.
|
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ 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 377ceff. Configure here.
377ceff to
781b9ca
Compare
🔍 Smart E2E Test Selection
click to see 🤖 AI reasoning detailsE2E Test Selection:
SmokePredictions is the primary tag as these changes directly affect the Predict feature's portfolio display and data fetching logic. Per SmokePredictions description, SmokeWalletPlatform must also be selected (Predictions is a section inside Trending tab). SmokeConfirmations is required per SmokePredictions description (opening/closing positions are on-chain transactions). Performance Test Selection: |
|




Description
Adds the reusable Predict portfolio UI components for PRED-899.
This PR is stacked on top of
predict/PRED-902-create-shared-predict-portfolio-data-hook-and-derived-model, which introduces the sharedusePredictPortfoliodata/model hook used by these components.Included components:
PredictPortfolioModulefor the homepage balance/portfolio surfacePredictPortfolioSummaryfor primary portfolio value and optional P&L/available balance displayPredictPortfolioActionsandPredictPortfolioActionfor Positions, Add funds, and Withdraw actionsPredictPortfoliotest IDs and barrel exportsThe module supports first-time, returning, loading, privacy mode, claimable winnings, positions badge count, guarded deposit/withdraw/claim flows, and amount-only P&L display when the portfolio model omits a percent.
This PR intentionally does not wire the portfolio module into
PredictFeed, feature flag rendering, or confirmation navigation. That integration will be handled in a follow-up stacked branch.Changelog
CHANGELOG entry: null
Related issues
Fixes: https://consensyssoftware.atlassian.net/browse/PRED-899
Depends on: https://consensyssoftware.atlassian.net/browse/PRED-902
Manual testing steps
Manual app QA: N/A for this stacked PR because the components are not integrated into the Predict feed in this branch.
Screenshots/Recordings
N/A. This branch adds reusable components only; feed integration and visual QA screenshots will be covered by the follow-up integration branch.
Before
N/A
After
Screen.Recording.2026-05-26.at.13.23.31.mov
Testing
NODE_OPTIONS=--max-old-space-size=8192 node .yarn/releases/yarn-4.14.1.cjs jest app/components/UI/Predict/components/PredictPortfolio/PredictPortfolioModule.test.tsx app/components/UI/Predict/components/PredictPortfolio/PredictPortfolioSummary.test.tsx --runInBand --watchman=false --forceExit --silent --coverage=falsenode .yarn/releases/yarn-4.14.1.cjs lint:tscgit diff --checkPre-merge author checklist
Performance checks (if applicable)
Pre-merge reviewer checklist
Note
Low Risk
New UI and hook tweaks only; deposit/withdraw/claim reuse existing guarded flows and the module is not yet integrated into the Predict feed.
Overview
Introduces reusable Predict portfolio UI for the homepage balance surface:
PredictPortfolioModulecomposes summary, Positions / Add funds / Withdraw actions, and an optional claim CTA, wired throughusePredictPortfolio, privacy mode,usePredictActionGuard, and deposit-wallet withdraw feature flags. PredictPortfolioSummary shows portfolio value with optional unrealized P&L and available balance (amount-only P&L when percent is omitted), loading skeletons, and masked values in privacy mode.usePredictPortfolio now enables account state when portfolio value is positive (not only cash balance), and account state failures no longer surface on the aggregate
errorfield. Newpredict.portfolio.*strings and test IDs support automation. Feed integration is explicitly out of scope for this branch.Reviewed by Cursor Bugbot for commit 781b9ca. Bugbot is set up for automated code reviews on this repo. Configure here.