Skip to content

feat(social): add a not-counted note to the performance p&l - #38569

Merged
ragkandala merged 14 commits into
cursor/flagged-position-subline-94b9from
cursor/uncounted-pnl-note-7800
Nov 2, 2026
Merged

ragkandala merged 14 commits into
cursor/flagged-position-subline-94b9from
cursor/uncounted-pnl-note-7800

Conversation

@ragkandala

@ragkandala ragkandala commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Description

Design prototype for TSA-1461, on top of the flag detection and greyed rows from #38549. V1 MyProfileView only. Legacy TraderProfileView behavior is unchanged, and P&L math is unchanged.

Under the Performance (30d) title, a dotted-underline note reads {count} positions not counted in P&L. That string is the button name. The P&L label and value are already separate text nodes, so the note does not repeat them. The hint is "Scrolls to positions not counted". Body Sm is 22pt; 11pt of vertical hit slop makes a 44pt target without changing the layout. Tapping scrolls to the pinned section and then moves screen-reader focus to the section header. The note is hidden when the count is 0.

Branch cursor/uncounted-pnl-note-7800 is based on #38567 (cursor/explain-uncounted-positions-7800, the sheet PR), which is based on #38568 (cursor/pin-uncounted-positions-7800, the pin PR). It does not restyle rows or change whether a flagged row can be tapped. Expect conflicts in ProfilePositionsTab with:

  • style(social): show flagged positions in a neutral subline instead of greying them out
  • feat(social): open position history from flagged rows

Defaults to confirm

  • Figma labels the cell Realized P&L. The code keeps the current 30D label P&L and attaches the note to that cell. The note's accessible name is only {count} positions not counted in P&L, because the cell already announces the label and value on their own.
  • The count is the flagged positions the list would show: the active Open or Closed tab, after the All / Tokens / Perps filter. It is not a separate P&L-server count.
  • On Posts, where the positions list is unmounted, the note uses the Open tab when that tab has flagged rows, otherwise Closed. The tap switches to that tab, then scrolls once the section lays out.
  • The note is hidden when the P&L cell itself is absent, when the count is 0, and on the owner's profile (showFlaggedState is off).
  • The same pin and sheet defaults as the parent PRs still apply.

Changelog

CHANGELOG entry: Added a note on profile P&L for positions that are not counted

The changelog sentence is a default to confirm. This is a design prototype, not a merged product decision.

Related issues

Fixes: TSA-1461

Manual testing steps

Feature: P&L note for positions that are not counted

  Scenario: the P&L note scrolls to the pinned section
    Given the V1 profile bundle flag is on
    And the user opens https://link.metamask.io/social/profile?traderId=<shittymike.sol profile id>
    And that profile is @shittymike.sol, which holds the flagged token Nigel
    And the 30D P&L cell is visible

    When the user taps "{count} positions not counted in P&L" under P&L
    Then the profile scrolls to the "Not counted in P&L" section
    And focus moves to that section header
    And Nigel is in that section

  Scenario: the note is hidden when nothing flagged is shown
    Given the user filters the positions list so no flagged row remains
    Then the note under P&L is hidden

  Scenario: the note is hidden on the owner's profile
    Given the user is viewing their own V1 profile
    Then the note under P&L is hidden

Screenshots/Recordings

Before

Before on origin/main, light mode: P&L stats, Open and Closed tabs, and the open Nigel row marked Insider allocation - excluded

After

After on 38569, light mode: dotted P&L note under the stats, 1 position not counted in P&L

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.

Assessed for this prototype: no device or power-user wallet was available here. The note is one extra text button, and the scroll measures a section that is already on screen. No new fetch or trace was added. Android and Sentry instrumentation were considered and not added.

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.
Open in Web Open in Cursor 

Note

Low Risk
UI-only social profile behavior with no P&L calculation or auth changes; scroll/tab edge cases are covered by tests.

Overview
Adds a dotted-underline note under the Performance (30d) header on V1 MyProfileView when the P&L stat is shown and flagged positions exist in the current list context. The copy is localized singular/plural (“{count} positions not counted in P&L”) with an accessibility hint to scroll to those rows.

Tapping the note navigates to the right Open/Closed tab (from Posts, Open is preferred when it has flagged rows, otherwise Closed), then scrolls the profile ScrollView to the pinned “Not counted in P&L” section via measureLayout, and moves screen-reader focus to that section header. Pending scrolls are cleared if the user switches tabs or changes the All/Tokens/Perps filter so a stale layout does not jump the list.

Counting and tab choice come from new resolveUncountedNoteTarget, aligned with the same tab + asset filter rules as the positions list. ProfilePositionsTab exposes refs/onLayout on the uncounted block for measurement; MyProfilePerformanceStats gains optional uncountedCount / onUncountedPress and a new test ID.

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

@github-actions github-actions Bot added size-M pr-not-ready-for-e2e Skip E2E and block merging. Remove this label once the PR is ready to run the E2E tests. labels Oct 30, 2026
@ragkandala ragkandala added the team-social-ai Social & AI team label Oct 30, 2026 — with Cursor
@cursor
cursor Bot force-pushed the cursor/explain-uncounted-positions-7800 branch from e2037a8 to bddc446 Compare October 30, 2026 16:26
@cursor
cursor Bot force-pushed the cursor/uncounted-pnl-note-7800 branch from df6d8c9 to 62c4ee0 Compare October 30, 2026 16:26
@github-actions github-actions Bot added size-L and removed size-M labels Oct 30, 2026
@ragkandala ragkandala self-assigned this Oct 30, 2026
@cursor
cursor Bot force-pushed the cursor/uncounted-pnl-note-7800 branch 5 times, most recently from 5c9f19d to 4ecf03c Compare October 30, 2026 17:23
@ragkandala ragkandala 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 Oct 30, 2026 — with Cursor
cursoragent and others added 5 commits October 30, 2026 18:08
The 30D P&L cell links to the pinned section with a count of the flagged
positions that list is showing.

Co-authored-by: Rag Kandala <ragkandala@users.noreply.github.com>
The note's name is only its own text, the target is 44pt, and focus
moves to the section header once the profile scrolls.

Co-authored-by: Rag Kandala <ragkandala@users.noreply.github.com>
The P&L note uses the same TouchableOpacity and underline structure as
the token stat bar.

Co-authored-by: Rag Kandala <ragkandala@users.noreply.github.com>
The note string is chosen with one ternary so the count check is not nested.

Co-authored-by: Rag Kandala <ragkandala@users.noreply.github.com>
The note sits in the Performance (30d) header instead of the half-width
P&L cell, so the copy is not truncated and the underline hugs the text.

Co-authored-by: Rag Kandala <ragkandala@users.noreply.github.com>
@cursor
cursor Bot force-pushed the cursor/uncounted-pnl-note-7800 branch from 4146a6f to afdce21 Compare October 30, 2026 18:16
@github-actions

github-actions Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Smart E2E Test Selection

Selected E2E tags: ALL

AI Confidence: 100

E2E reasoning

Expand to read

Hard rule seed (en-locale-change) mandates ALL tags as the floor because changes to locales/languages/en.json feed UI text and label selectors used across E2E smoke tests. Three new locale strings were added: not_counted_note_one, not_counted_note_other, and not_counted_note_hint — these are user-visible copy for the P&L uncounted positions note in the SocialLeaderboard/MyProfileView component.

Beyond the locale change, the PR modifies:

  1. MyProfileView.tsx — Adds scroll-to-uncounted-section behavior with refs and accessibility integration (functional UI change)
  2. MyProfilePerformanceStats.tsx — Adds a new touchable "uncounted note" UI element with dotted underline and press handler
  3. ProfilePositionsTab.tsx — Adds ref props for scroll targeting
  4. partitionUncountedPositions.ts — New resolveUncountedNoteTarget utility
  5. MyProfileView.testIds.ts — New PERFORMANCE_PNL_UNCOUNTED test ID

The functional changes are scoped to the SocialLeaderboard/MyProfileView area (Perps social trading), which maps primarily to SmokePerps and SmokeWalletPlatform. However, the locale change hard rule requires ALL tags to be run, as any smoke test asserting on UI text could be affected by copy changes. The ALL selection is maintained as the conservative and correct approach per the hard rule.

View run

@ragkandala
ragkandala marked this pull request as ready for review October 30, 2026 18:26
@ragkandala
ragkandala requested a review from a team as a code owner October 30, 2026 18:26
@ragkandala
ragkandala marked this pull request as draft October 30, 2026 18:28
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 89.36170% with 5 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (cursor/explain-uncounted-positions-7800@032b716). Learn more about missing BASE report.

Files with missing lines Patch % Lines
.../SocialLeaderboard/MyProfileView/MyProfileView.tsx 82.14% 3 Missing and 2 partials ⚠️
Additional details and impacted files
@@                            Coverage Diff                             @@
##             cursor/explain-uncounted-positions-7800   #38569   +/-   ##
==========================================================================
  Coverage                                           ?   87.57%           
==========================================================================
  Files                                              ?     7916           
  Lines                                              ?   230061           
  Branches                                           ?    58327           
==========================================================================
  Hits                                               ?   201484           
  Misses                                             ?    16297           
  Partials                                           ?    12280           

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

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

Stale Bugbot comment from a previous run.

@ragkandala
ragkandala marked this pull request as ready for review October 30, 2026 19:09

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

Nice work on the scroll + a11y focus hand-off. One blocker: Bugbot's point is valid. The note renders when pnl30d is missing and the P&L cell is dropped (MyProfilePerformanceStats.tsx:85-103). Can we gate it on the pnl cell being present and add a test? Smaller things: clear pendingUncountedScrollRef when the tab/filter changes so a later layout can't jump the scroll, and please sanity-check the measureLayout offset on device when the page is already scrolled. Also, should the count follow the asset filter too, not just the tab?

cursoragent and others added 3 commits November 1, 2026 23:00
…counted-pnl-note-7800

Bring the uncounted explainer fixes into the P&L note branch.

Co-authored-by: Rag Kandala <ragkandala@users.noreply.github.com>

# Conflicts:
#	app/components/Views/SocialLeaderboard/MyProfileView/MyProfileView.test.tsx
#	app/components/Views/SocialLeaderboard/MyProfileView/MyProfileView.tsx
#	app/components/Views/SocialLeaderboard/MyProfileView/components/ProfilePositionsTab.tsx
The note now renders only alongside the P&L cell, including when pnl30d
is missing and that cell is dropped.

Co-authored-by: Rag Kandala <ragkandala@users.noreply.github.com>
Only the note's own tab switch can still scroll. A later tab or filter
change drops that request before the next layout.

Co-authored-by: Rag Kandala <ragkandala@users.noreply.github.com>

Copy link
Copy Markdown
Contributor Author

Fixed in b1aad81. The note only renders when the P&L cell is present, with tests for both cases.

Copy link
Copy Markdown
Contributor Author

Done in b1fadf8. Changing the tab or filter clears the pending scroll, so a later layout can't jump the page. I added a test.

cursoragent and others added 4 commits November 1, 2026 23:47
…counted-pnl-note-7800

Bring the owner pinned section and explainer copy into the P&L note branch.

Co-authored-by: Rag Kandala <ragkandala@users.noreply.github.com>
The owner gets the same count, tab, and filter rules as other viewers, so
the note appears under Performance when flagged rows are pinned.

Co-authored-by: Rag Kandala <ragkandala@users.noreply.github.com>
…counted-pnl-note-7800

Co-authored-by: Rag Kandala <ragkandala@users.noreply.github.com>
…counted-pnl-note-7800

Co-authored-by: Rag Kandala <ragkandala@users.noreply.github.com>

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

Thanks! The blocker is fixed. The note only shows when the pnl cell is there, with tests for both cases (b1aad81), and the pending scroll clears on tab and filter changes (b1fadf8). The count also follows the asset filter now through resolveUncountedNoteTarget, which answers my other question.

Still open: did you get a chance to check the measureLayout offset on a device with the page already scrolled? The tests mock measureLayout and getNativeScrollRef, so they can't catch a wrong offset or a missing native ref (the scroll would just do nothing). A quick check on iOS and Android, or a short recording, and I'll approve. Small nit: the tab-change path has no test, only the filter one.

…counted-pnl-note-7800

Co-authored-by: Rag Kandala <ragkandala@users.noreply.github.com>
ragkandala added a commit that referenced this pull request Nov 2, 2026
…rofile (#38568)

<!--
Please submit this PR as a draft initially.

Do not mark it as "Ready for review" until this PR meets the canonical
Definition of Ready For Review in `docs/readme/ready-for-review.md`.

In short: the template must be materially complete (not just section
titles
present), all status checks must be currently passing, and the only
expected
follow-up commits must be reviewer-driven.
-->
<!--
mms-check directive vocabulary — read by
.github/scripts/shared/pr-template-checks.ts
at module load to build the validation plan. Directives are invisible in
rendered
markdown and must NOT be removed or edited without updating the
validator registry.

  type=text           Section must contain non-placeholder prose.
  type=changelog      Section must have a valid CHANGELOG entry: line.
type=issue-link Section must have a Fixes:/Closes:/Refs: line with a
value.
type=manual-testing Section must have real testing steps or an explicit
N/A.
type=screenshot Section must have evidence (image/URL) or an explicit
N/A.
type=checklist Section must have all checkboxes consciously checked.
required=true|false Whether a missing/invalid section runs the validator
at all.
blocking=true|false Whether a failure of this check fails the CI
workflow.
Default: false — failures are shown as warnings in the sticky
                      comment but do not block the PR.

Sections without a directive are checked for structural presence only.
-->

## **Description**

<!-- mms-check: type=text required=true -->

Design prototype for
[TSA-1461](https://consensyssoftware.atlassian.net/browse/TSA-1461),
built on the flag detection and greyed rows from #38549. This changes
the V1 profile only
(`app/components/Views/SocialLeaderboard/MyProfileView/`). Legacy
`TraderProfileView` behavior is unchanged. P&L math is unchanged: the
server already excludes flagged positions.

On another trader's profile (`showFlaggedState`), flagged rows leave the
Tokens and Perpetuals sections and render in a **Not counted in P&L**
section at the bottom of that tab's list. The section keeps the incoming
order, never collapses, and is hidden when the active filter shows no
flagged rows.

Branch `cursor/pin-uncounted-positions-7800` is based on `main`. It does
not restyle or re-enable rows, so it should not overlap the row
component itself, but it will conflict in `ProfilePositionsTab` with the
parallel work:

- `style(social): show flagged positions in a neutral subline instead of
greying them out` (row styling stays on `PositionRow`; this PR does not
touch it)
- `feat(social): open position history from flagged rows` (flagged rows
stay non-pressable, matching #38549)

Stacked on this branch:

- #38567 `feat(social): explain uncounted positions in a bottom sheet`
(`cursor/explain-uncounted-positions-7800`)
- #38569 `feat(social): add a not-counted note to the performance p&l`
(`cursor/uncounted-pnl-note-7800`, stacked on #38567)

### Defaults to confirm

- The pin applies to the active Open or Closed tab only.
`ProfilePositionsTab` already receives one of those lists. Closed
flagged rows do not appear on Open.
- The All / Tokens / Perps filter applies to the pinned section. A
flagged perp is hidden on Tokens and shown on Perps or All.
- The section renders after the Tokens and Perpetuals subsections, not
inside them. Flagged rows are removed from those subsections. Inside the
pinned section, input order is kept (tokens are not regrouped ahead of
perps).
- The section header is shown on Tokens and Perps filters too. The
Tokens / Perpetuals subheaders stay hidden unless All is selected, which
matches today.
- The pin is gated on `showFlaggedState`, which the V1 profile sets only
for other traders. The owner's own flagged rows stay in the normal
sections.
- V1 has no sort control today. The section uses the array order from
`useTraderPositions`. A later sort applied before this split still
leaves flagged rows at the bottom, in their relative order.
- The header is plain Body Sm text in `TextAlternative` (dark
`TextMuted` / grey500 is about 3.6:1 on black) and has
`accessibilityRole="header"`. The sheet PR replaces that plain title
with a button.
- Row styling and tappability are unchanged from #38549.

## **Changelog**

<!-- mms-check: type=changelog required=true blocking=true -->

CHANGELOG entry: Pinned positions that are not counted in P&L to the
bottom of a trader profile

The changelog sentence is a default to confirm. This is a design
prototype, not a merged product decision.

## **Related issues**

<!-- mms-check: type=issue-link required=true -->

Fixes:
[TSA-1461](https://consensyssoftware.atlassian.net/browse/TSA-1461)

## **Manual testing steps**

<!-- mms-check: type=manual-testing required=true -->

```gherkin
Feature: positions not counted in P&L

  Scenario: flagged positions sit at the bottom of the open list
    Given the V1 profile bundle flag is on
    And the user opens https://link.metamask.io/social/profile?traderId=<shittymike.sol profile id>
    And that profile is @shittymike.sol, which holds the flagged token Nigel

    When the user opens the Open tab
    Then Nigel is not mixed into Tokens or Perpetuals
    And Nigel appears under "Not counted in P&L" at the bottom of the list
    And unflagged rows stay above that section in their existing order

  Scenario: the section follows the asset filter and hides when empty
    Given the Open tab shows Nigel as flagged and at least one unflagged token
    When the user selects the Perps filter and Nigel is not a perp
    Then the "Not counted in P&L" section is hidden
    And the empty perps state shows when no perp rows remain

  Scenario: the owner's own profile does not pin flagged rows
    Given the user is viewing their own V1 profile
    And one of their positions has a flag
    Then that row stays in Tokens or Perpetuals
    And "Not counted in P&L" is not shown
```

## **Screenshots/Recordings**

<!-- mms-check: type=screenshot required=true -->

### **Before**

<img alt="Before on origin/main, light mode: P&L stats, Open and Closed
tabs, and the open Nigel row marked Insider allocation - excluded"
src="https://cursor.com/artifacts/c/art-31770944-64c2-4e3b-8a97-b348568ce624"
/>

### **After**

<img alt="After on 38568, light mode: pinned Not counted in P&L section
under the open token rows"
src="https://cursor.com/artifacts/c/art-b01f9666-0506-4275-9bf7-981e05058248"
/>

## **Pre-merge author checklist**

<!-- mms-check: type=checklist required=true -->

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

#### Performance checks (if applicable)

- [x] I've tested on Android
  - Ideally on a mid-range device; emulator is acceptable
- [x] I've tested with a power user scenario
- Use these [power-user
SRPs](https://consensyssoftware.atlassian.net/wiki/spaces/TL1/pages/edit-v2/401401446401?draftShareId=9d77e1e1-4bdc-4be1-9ebb-ccd916988d93)
to import wallets with many accounts and tokens
- [x] I've instrumented key operations with Sentry traces for production
performance metrics
- See [`trace()`](/app/util/trace.ts) for usage and
[`addToken`](/app/components/Views/AddAsset/components/AddCustomToken/AddCustomToken.tsx#L274)
for an example

For performance guidelines and tooling, see the [Performance
Guide](https://consensyssoftware.atlassian.net/wiki/spaces/TL1/pages/400085549067/Performance+Guide+for+Engineers).

Assessed for this prototype: no device or power-user wallet was
available here. The change partitions an existing short list once per
render and adds no fetch, animation, or trace. Android and Sentry
instrumentation were considered and not added.

## **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]
> **Low Risk**
> UI-only social profile list layout and presentation; P&L calculation
is unchanged and coverage is broad in tests.
> 
> **Overview**
> Adds a **Not counted in P&L** section at the bottom of profile
position lists (Open/Closed), after Tokens and Perpetuals. Flagged
positions are split out via `partitionUncountedPositions`, removed from
the main sections, and listed in input order; the All/Tokens/Perps
filter applies to this block too.
> 
> **`PositionRow`** replaces `showFlaggedState` with
**`flaggedPresentation`**: **`excluded`** keeps the legacy trader
profile (grey row, long exclusion line, non-tappable); **`subline`**
appends short flag text to the subtitle, keeps P&L colors, and adds
VoiceOver copy. Legacy **`TraderProfileView`** passes `excluded`; V1
**`ProfilePositionsTab`** uses `subline` when viewing someone else
(`showFlaggedState`) and omits it for the owner so flagged rows stay
tappable while still appearing in the pinned section.
> 
> New i18n covers the section title, short flag labels, and
accessibility strings. Unit/integration tests cover partitioning,
filtering, navigation from owner flagged rows, and row presentations.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
3906ffb. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->


[TSA-1461]:
https://consensyssoftware.atlassian.net/browse/TSA-1461?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ

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

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ 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 37aab97. Configure here.

…counted-pnl-note-7800

Co-authored-by: Rag Kandala <ragkandala@users.noreply.github.com>

Copy link
Copy Markdown
Contributor Author

Hey @aganglada 👋 I've addressed your feedback and CI is green or nearly there on the latest commits. Could you take another look when you get a chance? Hoping to land these today. Thanks!

@sonarqubecloud

sonarqubecloud Bot commented Nov 2, 2026

Copy link
Copy Markdown

ragkandala added a commit that referenced this pull request Nov 2, 2026
<!--
Please submit this PR as a draft initially.

Do not mark it as "Ready for review" until this PR meets the canonical
Definition of Ready For Review in `docs/readme/ready-for-review.md`.

In short: the template must be materially complete (not just section
titles
present), all status checks must be currently passing, and the only
expected
follow-up commits must be reviewer-driven.
-->
<!--
mms-check directive vocabulary — read by
.github/scripts/shared/pr-template-checks.ts
at module load to build the validation plan. Directives are invisible in
rendered
markdown and must NOT be removed or edited without updating the
validator registry.

  type=text           Section must contain non-placeholder prose.
  type=changelog      Section must have a valid CHANGELOG entry: line.
type=issue-link Section must have a Fixes:/Closes:/Refs: line with a
value.
type=manual-testing Section must have real testing steps or an explicit
N/A.
type=screenshot Section must have evidence (image/URL) or an explicit
N/A.
type=checklist Section must have all checkboxes consciously checked.
required=true|false Whether a missing/invalid section runs the validator
at all.
blocking=true|false Whether a failure of this check fails the CI
workflow.
Default: false — failures are shown as warnings in the sticky
                      comment but do not block the PR.

Sections without a directive are checked for structural presence only.
-->

## **Description**

<!-- mms-check: type=text required=true -->

Design prototype for
[TSA-1461](https://consensyssoftware.atlassian.net/browse/TSA-1461), on
top of the flag detection and greyed rows from #38549. V1
`MyProfileView` only. Legacy `TraderProfileView` behavior is unchanged,
and P&L math is unchanged.

The **Not counted in P&L** header follows the Token Details stat-bar
dotted underline: a `TouchableOpacity` around `DottedUnderline`, Body Sm
Medium, default text color. Spacing tokens `px-4 pt-4 pb-2` make the
46pt row. The sheet uses design-system `BottomSheetHeader` (title and
close) and `BottomSheetFooter` `primaryButtonProps` for **Got it**.

The sheet lists three explanations. The third is **Unsupported token**:
"We can't track P&L for unsupported tokens like deposits in lending
pools." That item is explanation copy only. There is no unsupported flag
yet, so counting and partition logic are unchanged.

Branch `cursor/explain-uncounted-positions-7800` is based on #38568
(`cursor/pin-uncounted-positions-7800`, the pin-section PR). It does not
restyle rows or change whether a flagged row can be tapped. Expect
conflicts in `ProfilePositionsTab` with:

- `style(social): show flagged positions in a neutral subline instead of
greying them out`
- `feat(social): open position history from flagged rows`

The P&L-note PR #38569 (`cursor/uncounted-pnl-note-7800`) is stacked on
this branch.

### Defaults to confirm

- Visible title stays **Not counted in P&L**. The count is only in the
accessibility label: "Not counted in P&L, {count} position(s). Learn
why".
- Header type is Body Sm Medium, default text color, padding 16/8/16
(`pt-4 pb-2 px-4`), minimum height 46. `DottedUnderline` draws a 1.5px
stroke; Figma's ~1.25px is not a separate style because the shared
component is unchanged.
- The sheet always lists Insider, Contract creator, and Unsupported
token. Unsupported token is final explanation copy only. There is no
unsupported flag, and counting is unchanged.
- Labels use default text; definitions use the muted alternative color.
- **Got it** is the footer primary button and closes through
`onCloseBottomSheet`. The header close control does the same.
- The same pin defaults as the parent PR still apply (per active tab,
filter applies, owner profile excluded).

## **Changelog**

<!-- mms-check: type=changelog required=true blocking=true -->

CHANGELOG entry: Added an explanation for positions that are not counted
in P&L

The changelog sentence is a default to confirm. This is a design
prototype, not a merged product decision.

## **Related issues**

<!-- mms-check: type=issue-link required=true -->

Fixes:
[TSA-1461](https://consensyssoftware.atlassian.net/browse/TSA-1461)

## **Manual testing steps**

<!-- mms-check: type=manual-testing required=true -->

```gherkin
Feature: explanation for positions not counted in P&L

  Scenario: the section header opens one explanation
    Given the V1 profile bundle flag is on
    And the user opens https://link.metamask.io/social/profile?traderId=<shittymike.sol profile id>
    And that profile is @shittymike.sol, which holds the flagged token Nigel
    And the Open tab shows the "Not counted in P&L" section

    When the user taps the "Not counted in P&L" header
    Then a sheet titled "Why some positions aren't counted" opens
    And the sheet explains Insider, Contract creator, and Unsupported token
    When the user taps Got it
    Then the sheet closes
    And the positions list is unchanged

  Scenario: one flagged position uses the singular label
    Given the visible list has exactly one flagged position
    Then the header's accessibility label is "Not counted in P&L, 1 position. Learn why"
```

## **Screenshots/Recordings**

<!-- mms-check: type=screenshot required=true -->

### **Before**

<img alt="Before on origin/main, light mode: P&L stats, Open and Closed
tabs, and the open Nigel row marked Insider allocation - excluded"
src="https://cursor.com/artifacts/c/art-31770944-64c2-4e3b-8a97-b348568ce624"
/>

### **After**

<img alt="After on 38567, light mode: UncountedPositionsSheet with
Insider, Contract creator, and Unsupported token, including We can't
track P&L for unsupported tokens like deposits in lending pools."
src="https://cursor.com/artifacts/c/art-57de7a81-a827-4c92-a683-5e98dc9b5677"
/>

## **Pre-merge author checklist**

<!-- mms-check: type=checklist required=true -->

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

#### Performance checks (if applicable)

- [x] I've tested on Android
  - Ideally on a mid-range device; emulator is acceptable
- [x] I've tested with a power user scenario
- Use these [power-user
SRPs](https://consensyssoftware.atlassian.net/wiki/spaces/TL1/pages/edit-v2/401401446401?draftShareId=9d77e1e1-4bdc-4be1-9ebb-ccd916988d93)
to import wallets with many accounts and tokens
- [x] I've instrumented key operations with Sentry traces for production
performance metrics
- See [`trace()`](/app/util/trace.ts) for usage and
[`addToken`](/app/components/Views/AddAsset/components/AddCustomToken/AddCustomToken.tsx#L274)
for an example

For performance guidelines and tooling, see the [Performance
Guide](https://consensyssoftware.atlassian.net/wiki/spaces/TL1/pages/400085549067/Performance+Guide+for+Engineers).

Assessed for this prototype: no device or power-user wallet was
available here. The sheet mounts only after the header is pressed and
adds no fetch, list virtualization, or trace. Android and Sentry
instrumentation were considered and not added.

## **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.

<div><a
href="https://cursor.com/agents/bc-01b8501f-e175-5c30-bbcd-6a9f3fabb11b?cursor_ref=pr_footer&cursor_cta=open_in_web"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://cursor.com/assets/images/open-in-web-dark.png"><source
media="(prefers-color-scheme: light)"
srcset="https://cursor.com/assets/images/open-in-web-light.png"><img
alt="Open in Web" width="114" height="28"
src="https://cursor.com/assets/images/open-in-web-dark.png"></picture></a>&nbsp;<a
href="https://cursor.com/background-agent?bcId=bc-01b8501f-e175-5c30-bbcd-6a9f3fabb11b&cursor_ref=pr_footer&cursor_cta=open_in_cursor"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://cursor.com/assets/images/open-in-cursor-dark.png"><source
media="(prefers-color-scheme: light)"
srcset="https://cursor.com/assets/images/open-in-cursor-light.png"><img
alt="Open in Cursor" width="131" height="28"
src="https://cursor.com/assets/images/open-in-cursor-dark.png"></picture></a>&nbsp;</div>

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Low Risk**
> UI-only social profile education with no API, auth, or P&L calculation
changes; sheet mounts on demand from local state.
> 
> **Overview**
> Adds a **Not counted in P&L** explainer on V1 `MyProfileView`: the
section header is now a tappable control with dotted underline styling
and accessibility copy that includes the flagged count (“Learn why”),
wired through `onUncountedHeaderPress` to open a new
`UncountedPositionsSheet`.
> 
> The bottom sheet uses design-system `BottomSheet` with title **Why
some positions aren't counted**, three static reasons (Insider, Contract
creator, Unsupported token), and **Got it** / header close to dismiss.
Insider and contract-creator bodies switch between “You…” and “This
trader…” via `isOwner`; unsupported-token text is informational only and
does not change which rows are partitioned or counted.
> 
> New i18n keys and test IDs support the flow; unit and integration
tests cover header press, sheet lifecycle, and owner vs visitor copy.
P&L partitioning and legacy `TraderProfileView` are unchanged.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
3435338. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->


[TSA-1461]:
https://consensyssoftware.atlassian.net/browse/TSA-1461?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
Base automatically changed from cursor/explain-uncounted-positions-7800 to cursor/flagged-position-subline-94b9 November 2, 2026 20:41
@ragkandala
ragkandala merged commit b7d6552 into cursor/flagged-position-subline-94b9 Nov 2, 2026
97 checks passed
@ragkandala
ragkandala deleted the cursor/uncounted-pnl-note-7800 branch November 2, 2026 20:42
@github-actions github-actions Bot locked and limited conversation to collaborators Nov 2, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

size-L team-social-ai Social & AI team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants