Repository navigation
style(social): show flagged positions in a neutral subline instead of greying them out - #38564
Conversation
…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>
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>
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>
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>
Smart E2E Test SelectionSelected E2E tags: ALL AI Confidence: 100 E2E reasoningExpand to readHard 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:
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. |
…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>
|
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! |
<!--
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> <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> </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> <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> </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
Pull request was converted to draft
Co-authored-by: Rag Kandala <ragkandala@users.noreply.github.com>
aganglada
left a comment
There was a problem hiding this comment.
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.
|
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>
|



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(viaProfilePositionsTab), 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 example21.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 exampleNigel, $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.
PositionRowis shared with the legacy profile, so the greyed treatment is nowflaggedPresentation="excluded"and the V1 treatment isflaggedPresentation="subline".TraderProfileViewstill passesexcluded, 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 bypartitionUncountedPositions. 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
21.15M Nigel · Excluded, screen reader reasonexcluded). feat(social): grey out flagged trader profile positions #38549 used "Excluded from PnL" for the same case.creatorin the screen reader label, matching the requested short label rather than the legacy "Contract creator - excluded".unchanged 0.00%rather thanup 0.00%. When percent is missing, the direction clause is omitted:Nigel, $693.24, not counted in P&L, insider.Apr 15 at 2:00 pm · Insider). This PR does not switch that line to a relative time such as2d ago.ProfilePositionsTabalready receives one of those lists. Closed flagged rows do not appear on Open.useTraderPositions. A later sort applied before this split still leaves flagged rows at the bottom, in their relative order.TextAlternative(darkTextMuted/ grey500 is about 3.6:1 on black) and hasaccessibilityRole="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-controllers3.14.0 typesPosition.flagsasstring[] | nulland exports onlyINSIDER_POSITION_FLAG = 'insider'andDEVELOPER_POSITION_FLAG = 'developer'(node_modules/@metamask/social-controllers/dist/social-types.d.ts).https://social.dev-api.cx.metamask.io/api/docsenums positionflagsitems asinsideronly.6bbea1a3-a774-43da-b46f-cd35d72bf4b1(shittymike.sol): open positions (GET /api/v2/.../positions/open) and closed positions (GET /api/v1/.../positions/closed) return onlyinsideror[].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
Screenshots/Recordings
Before
After
Pre-merge author checklist
Performance checks (if applicable)
trace()for usage andaddTokenfor an exampleFor 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
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
showFlaggedStatewithflaggedPresentation:excludedkeeps the legacy grey row, muted P&L, long exclusion line, and blocked taps (TraderProfileView unchanged).sublinekeeps 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 whenshowFlaggedStateis 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.