Skip to content

style(social): show flagged positions in a neutral subline instead of greying them out - #38564

Merged
ragkandala merged 49 commits into
mainfrom
cursor/flagged-position-subline-94b9
Nov 4, 2026
Merged

ragkandala merged 49 commits into
mainfrom
cursor/flagged-position-subline-94b9

Conversation

@ragkandala

@ragkandala ragkandala commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Description

Design polish for Rag Kandala on the V1 trader profile only. This is a prototype for review, not a merged product decision. Baseline is #38549, which greys flagged positions, drops P&L colour, and shows a separate line such as "Insider allocation - excluded".

On MyProfileView (via ProfilePositionsTab), flagged rows now stay at full opacity with the normal green/red P&L colours. The flag is a plain suffix on the existing muted subtitle, for example 21.15M Nigel · Insider, 84.1K Moodeng · Creator, or a closed row's trade date plus · Insider. The short words are Insider and Creator. An unrecognized flag uses Excluded. The screen reader announcement for a flagged V1 row says the position is not counted in P&L and why, for example Nigel, $693.24, up 47.28%, not counted in P&L, insider.

Tap gating is unchanged from #38549: a flagged row on someone else's profile still does not open. This PR does not add the explainer sheet or the P&L note.

Flagged rows look normal but stay non-tappable until #38566 lands, and #38564 and #38566 both edit the press gating in PositionRow so they should land together or the second rebases.

PositionRow is shared with the legacy profile, so the greyed treatment is now flaggedPresentation="excluded" and the V1 treatment is flaggedPresentation="subline". TraderProfileView still passes excluded, so V0 renders as it does today. Omitting the prop still leaves flagged data looking and behaving like an unflagged row (composer and own profile).

Not counted in P&L section

On a V1 profile, flagged rows also leave the Tokens and Perpetuals sections and render in a Not counted in P&L section at the bottom of that tab's list. On another trader's profile (showFlaggedState) they use the subline treatment above and are not tappable. The split is done by partitionUncountedPositions. The section keeps the incoming order, never collapses, and is hidden when the active filter shows no flagged rows. P&L math is unchanged: the server already excludes flagged positions.

#38568 was merged into this branch (56a63f4) and its changes ship here.

Defaults to confirm

  • Unknown flags use the short word Excluded (subtitle 21.15M Nigel · Excluded, screen reader reason excluded). feat(social): grey out flagged trader profile positions #38549 used "Excluded from PnL" for the same case.
  • Developer flag copy is Creator in the subtitle and creator in the screen reader label, matching the requested short label rather than the legacy "Contract creator - excluded".
  • Break-even rows are announced as unchanged 0.00% rather than up 0.00%. When percent is missing, the direction clause is omitted: Nigel, $693.24, not counted in P&L, insider.
  • Closed rows keep the existing trade-date subtitle (Apr 15 at 2:00 pm · Insider). This PR does not switch that line to a relative time such as 2d ago.
  • Changelog wording below is a suggestion, not final release copy.
  • 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 applies on every V1 profile. On the owner's own profile, flagged rows are also pinned to Not counted in P&L, stay full color and tappable, and use the default presentation. The owner copy ("You…") lands in feat(social): explain uncounted positions in a bottom sheet #38567.
  • 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 (feat(social): explain uncounted positions in a bottom sheet #38567) replaces that plain title with a button.

Waiting on backend

Joe asked about a third not-counted case: tokens we do not support P&L for. The backend flag for it will be unsupported-token, and Joe's separate PR handles that flag and its Unsupported subline, so this PR does not add it. Today the installed client and the dev API don't send it yet:

  • @metamask/social-controllers 3.14.0 types Position.flags as string[] | null and exports only INSIDER_POSITION_FLAG = 'insider' and DEVELOPER_POSITION_FLAG = 'developer' (node_modules/@metamask/social-controllers/dist/social-types.d.ts).
  • Dev OpenAPI at https://social.dev-api.cx.metamask.io/api/docs enums position flags items as insider only.
  • Trader 6bbea1a3-a774-43da-b46f-cd35d72bf4b1 (shittymike.sol): open positions (GET /api/v2/.../positions/open) and closed positions (GET /api/v1/.../positions/closed) return only insider or [].

Changelog

CHANGELOG entry: Updated flagged positions on trader profiles so they stay in colour, show Insider or Creator on the subtitle, and are pinned to a Not counted in P&L section at the bottom of the list

Related issues

Fixes: TSA-1461

Manual testing steps

Feature: neutral flag suffix on the V1 trader profile

  Background:
    Given the V1 profile bundle flag is on
    And I open @shittymike.sol from the social leaderboard
    Or I open the deep link "https://link.metamask.io/social/profile?traderId=<id>" for that profile
    And that profile holds the flagged token Nigel

  Scenario: flagged open row is not greyed out
    Given I am on the Open tab
    When I look at the Nigel position
    Then the row is full opacity
    And the P&L percent keeps its green or red colour
    And the subtitle ends with "· Insider"
    And I do not see a separate line "Insider allocation - excluded"

  Scenario: flagged closed row uses the same suffix
    Given I am on the Closed tab
    When I look at a flagged Nigel position
    Then the trade-date subtitle ends with "· Insider"
    And the row is not greyed out

  Scenario: unflagged rows stay the same
    When I look at an unflagged position
    Then the subtitle has no flag suffix
    And tapping it still opens the position

  Scenario: tap gating is unchanged from the greyed version
    When I tap the flagged Nigel row on someone else's profile
    Then it still does not open the position or quick buy screen

  Scenario: legacy profile is unchanged
    Given I am on the legacy trader profile
    When I look at a flagged position
    Then the row is still greyed out
    And I still see "Insider allocation - excluded" on its own line
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 flagged rows are pinned and stay tappable
    Given the user is viewing their own V1 profile
    And one of their positions has a flag
    Then that row appears under "Not counted in P&L" at the bottom of the list
    And the row stays full color
    And tapping the row opens its position history

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

Before on origin/main, light mode: closed tab with Nigel rows marked Insider allocation - excluded

After

After on 38564, light mode: open Nigel row with neutral subline 21.15M Nigel · Insider and red P&L

After on 38568, light mode: pinned Not counted in P&L section under the open token rows

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 draft: the diff changes subtitle copy, opacity, and P&L colour on an existing row, and partitions an existing short list once per render for the pinned section. It does not add a fetch, selector, animation, image, or new trace. Android, power-user, and Sentry checks were considered and not run on a device.

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 leaderboard presentation and list ordering; legacy trader profile behavior is preserved via excluded, with no auth or P&L calculation changes.

Overview
V1 profile position lists now split server-flagged rows into a bottom Not counted in P&L section (via partitionUncountedPositions), preserving input order and honoring the All / Tokens / Perps filter. Counted rows render first; flagged rows no longer mix into the main list.

PositionRow replaces showFlaggedState with flaggedPresentation: excluded keeps the legacy grey row, muted P&L, long exclusion line, and blocked taps (TraderProfileView unchanged). subline keeps full opacity and green/red P&L, appends short labels (e.g. · Insider) on the subtitle, and adds screen-reader copy; taps stay blocked on other traders when showFlaggedState is set, but own-profile flagged rows stay default presentation and open position history when tapped.

New i18n covers short flag words, accessibility strings, and the section header. Tests cover partitioning, tab behavior, row presentations, and owner navigation.

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

cursoragent and others added 2 commits October 30, 2026 15:46
…rofile

Flagged rows on another trader's V1 profile leave the Tokens and Perps
sections and sit in a Not counted in P&L section that stays in input order.

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

On the V1 profile, flagged rows stay full opacity with normal P&L colours and append a short flag word to the existing subtitle. The legacy trader profile keeps the greyed exclusion line.

Co-authored-by: Rag Kandala <ragkandala@users.noreply.github.com>
@ragkandala ragkandala added the team-social-ai Social & AI team label Oct 30, 2026 — with Cursor
@github-actions github-actions Bot added size-L 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
cursoragent and others added 4 commits October 30, 2026 16:16
Pressable rows announce as buttons, and the flagged-row label sits on that same control instead of a nested node.

Co-authored-by: Rag Kandala <ragkandala@users.noreply.github.com>
TextMuted at body small is about 3.6:1 on black. The plain title uses
TextAlternative and is announced as a header.

Co-authored-by: Rag Kandala <ragkandala@users.noreply.github.com>
The Not counted in P&L header is a dotted-underline button that opens one
sheet for insider and contract-creator exclusions.

Co-authored-by: Rag Kandala <ragkandala@users.noreply.github.com>
The uncounted header fills with the pressed token, and the explainer uses
BottomSheetHeader and BottomSheetFooter.

Co-authored-by: Rag Kandala <ragkandala@users.noreply.github.com>
@ragkandala ragkandala self-assigned this Oct 30, 2026
cursoragent and others added 6 commits October 30, 2026 16:45
The uncounted header uses the same TouchableOpacity and underline
structure as the token stat bar.

Co-authored-by: Rag Kandala <ragkandala@users.noreply.github.com>
The sheet lists lending-style tokens that are left out of P&L. This is
explanation copy only and does not add a flag.

Co-authored-by: Rag Kandala <ragkandala@users.noreply.github.com>
The sheet body now matches the final Figma line for unsupported tokens.

Co-authored-by: Rag Kandala <ragkandala@users.noreply.github.com>
The sheet body now says P&L cannot be measured for deposit tokens like
lending pools.

Co-authored-by: Rag Kandala <ragkandala@users.noreply.github.com>
The sheet body now says P&L cannot be tracked for unsupported tokens
like deposits in lending pools.

Co-authored-by: Rag Kandala <ragkandala@users.noreply.github.com>
Sonar S3923 flagged the closed perp and spot headline as the same JSX. The value and direction ternaries move into helpers with the same results.

Co-authored-by: Rag Kandala <ragkandala@users.noreply.github.com>
@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 6 commits October 30, 2026 18:08
The section title underline now sizes to the label, and flagged rows in
the pinned section stay at full opacity until the subline presentation lands.

Co-authored-by: Rag Kandala <ragkandala@users.noreply.github.com>
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>
@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
@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 mandates ALL due to en.json changes. The locale changes add new position flag strings (short labels, accessibility labels) for the SocialLeaderboard feature. While these are additive-only (new keys, no existing string modifications), the hard rule for en.json is absolute.

Beyond the locale change, the functional changes are scoped to the SocialLeaderboard feature area:

  • PositionRow.tsx: significant refactor replacing showFlaggedState boolean with flaggedPresentation enum, adding accessibility labels, new headline value formatting logic
  • positionFlags.ts: new utility functions for accessibility labels, short labels, PnL direction
  • TraderProfileView.tsx: prop change from showFlaggedState to flaggedPresentation="excluded"
  • ProfilePositionsTab.tsx: now partitions positions into counted/uncounted sections using new partitionUncountedPositions utility
  • New partitionUncountedPositions.ts utility

These changes affect the Perps (SmokePerps) and Trending/SmokeWalletPlatform flows. The PositionRow component is used in both TraderProfileView and MyProfileView. No smoke specs directly test SocialLeaderboard views, but the perps smoke specs (tests/smoke-appium/perps/) exercise the broader perps flow. The locale additions could affect any E2E test that asserts on position-related text labels.

Running ALL is the conservative and correct approach given the hard rule seed floor.

View run

@ragkandala
ragkandala marked this pull request as ready for review October 30, 2026 19:09
cursoragent and others added 2 commits November 2, 2026 19:34
…in-uncounted-positions-7800

Keep the explainer's real-row label and header coverage while taking the
parent's compacted filter cases.

Co-authored-by: Rag Kandala <ragkandala@users.noreply.github.com>
…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 on the latest commits. Could you take another look when you get a chance? Hoping to land these today. Thanks!

@ragkandala
ragkandala enabled auto-merge November 2, 2026 20:41
<!--
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
<!--
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.

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

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

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

<!-- 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: 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**

<!-- 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 38569, light mode: dotted P&L note under the stats, 1
position not counted in P&L"
src="https://cursor.com/artifacts/c/art-d119d1c1-a0ab-4ef3-b216-917806eff490"
/>

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

<div><a
href="https://cursor.com/agents/bc-ca96e482-1f95-567e-83e9-0c1f1ca23b58?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-ca96e482-1f95-567e-83e9-0c1f1ca23b58&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 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.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
ccc30c7. 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
@github-actions github-actions Bot added size-XL and removed size-L labels Nov 2, 2026
@ragkandala
ragkandala marked this pull request as draft November 2, 2026 20:45
auto-merge was automatically disabled November 2, 2026 20:45

Pull request was converted to draft

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 Rag. flaggedPresentation is now the single source of truth. Legacy excluded rows stay greyed and non-pressable, and subline rows keep full colour. Folding #38568 in works for me. I also checked that the diff is clean after the accidental #38567/#38569 merge and revert: no sheet or note code is left over. CI is green.

On landing order: please squash-merge this one first, then land #38566 on top of it and retarget #38681 to main.

ragkandala commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor Author

Thanks @aganglada! Nothing else open here. Could you hit Approve when you get a sec? GitHub still shows it as blocked. I'll squash-merge this one first, then land #38566 on top and retarget #38681 to main.

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

sonarqubecloud Bot commented Nov 4, 2026

Copy link
Copy Markdown

@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 Rag, landing order sounds good. This one first, then #38566, then #38681/#38682 retargeted to main. The only new thing since my last pass is the main merge. Approving.

@ragkandala
ragkandala added this pull request to the merge queue Nov 4, 2026
@ragkandala
ragkandala removed this pull request from the merge queue due to a manual request Nov 4, 2026
@ragkandala
ragkandala added this pull request to the merge queue Nov 4, 2026
Merged via the queue into main with commit 972c993 Nov 4, 2026
198 of 200 checks passed
@ragkandala
ragkandala deleted the cursor/flagged-position-subline-94b9 branch November 4, 2026 14:53
@github-actions github-actions Bot locked and limited conversation to collaborators Nov 4, 2026
@metamask-ci metamask-ci Bot added the release-8.20.0 Issue or pull request that will be included in release 8.20.0 label Nov 4, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

release-8.20.0 Issue or pull request that will be included in release 8.20.0 size-L team-social-ai Social & AI team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants