Skip to content

Conversation

@michalconsensys
Copy link
Contributor

@michalconsensys michalconsensys commented Nov 18, 2025

Description

This PR adds a "Recent activity" section to the Perps Market Details view, displaying the 3 most recent trades for the selected market.

Changelog

CHANGELOG entry: Added recent activity section to Perps market details screen showing the 3 most recent trades

Related issues

Fixes: https://consensyssoftware.atlassian.net/browse/TAT-1968?atlOrigin=eyJpIjoiODNjZmM2NDUwZGM2NDVmMmE1NmM5MGI5NDJmODBkMGIiLCJwIjoiaiJ9

Manual testing steps

Feature: Recent activity on Perps market details

  Scenario: user views recent trades for a market with activity
    Given user is on the Perps market details screen for ETH
    And user has completed at least one trade for ETH

    When user scrolls to the "Recent activity" section
    Then user sees up to 3 recent trades for ETH market
    And each trade displays the token logo, trade type (e.g., "Opened long"), size, and PnL/fee amount
    And user sees a "See all" button in the header

  Scenario: user navigates to full activity list
    Given user is on the Perps market details screen
    And the "Recent activity" section is visible

    When user taps the "See all" button
    Then user is navigated to the Activity screen with the Trades tab selected
    And user sees the back button to return to market details

  Scenario: user views trade details
    Given user is on the Perps market details screen
    And the "Recent activity" section shows trades

    When user taps on a trade item
    Then user is navigated to the position transaction detail screen
    And user sees full details of the selected trade

  Scenario: user views market with no recent activity
    Given user is on the Perps market details screen for a market
    And user has no trades for this market

    When user scrolls to the "Recent activity" section
    Then user sees "No recent activity" message

  Scenario: user views loading state
    Given user is on the Perps market details screen
    And trades are being fetched

    When the "Recent activity" section is loading
    Then user sees skeleton loading indicators for 3 rows

Screenshots/Recordings

Before

After

Simulator.Screen.Recording.-.iPhone.16e.-.2025-11-18.at.13.02.52.mov

Pre-merge author checklist

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.

Note

Adds a "Recent activity" section to Perps Market Details showing up to 3 latest trades with navigation to Activity and trade detail, plus supporting constants, i18n, and tests.

  • Perps Market Details UI:
    • Integrates PerpsMarketTradesList into PerpsMarketDetailsView, positioned above the risk disclaimer; moves PerpsNavigationCard below the disclaimer.
  • New Component: components/PerpsMarketTradesList
    • Fetches order fills via usePerpsOrderFills, transforms to transactions, filters by symbol, sorts by timestamp, and limits to PERPS_CONSTANTS.RECENT_ACTIVITY_LIMIT.
    • Renders header with title and "See all" (navigates to Routes.PERPS.ACTIVITY), shows skeleton while loading, empty state when no trades, and navigates to Routes.PERPS.POSITION_TRANSACTION on item press.
  • Constants: Adds PERPS_CONSTANTS.RECENT_ACTIVITY_LIMIT = 3 in perpsConfig.
  • i18n: Adds perps.market.recent_trades and perps.market.no_trades strings.
  • Tests: Comprehensive tests for loading/empty states, rendering, navigation, hook params, filtering/limiting, edge cases, and FlatList config in PerpsMarketTradesList.test.tsx.

Written by Cursor Bugbot for commit 2db4a4a. This will update automatically on new commits. Configure here.

@michalconsensys michalconsensys added the team-perps Perps team label Nov 18, 2025
@github-actions
Copy link
Contributor

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

@michalconsensys michalconsensys marked this pull request as ready for review November 18, 2025 15:40
@michalconsensys michalconsensys requested a review from a team as a code owner November 18, 2025 15:40
abretonc7s
abretonc7s previously approved these changes Nov 20, 2025
Copy link
Contributor

@abretonc7s abretonc7s left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved but is there a way we can prevent the high duplication of code? currently sonarcloud seems to fail at 12.6% of duplicated code

@github-actions
Copy link
Contributor

🔍 Smart E2E Test Selection

  • Selected E2E tags: SmokePerps
  • Risk Level: low
  • AI Confidence: 95%
click to see 🤖 AI reasoning details

This PR adds a new "Recent Trades" component to the Perps market details view. The changes are:

  1. New Component Created: PerpsMarketTradesList - displays recent trades for a specific market

    • Shows up to 3 recent trades filtered by market symbol
    • Includes loading states, empty states, and trade detail navigation
    • Uses existing hooks (usePerpsOrderFills) and utilities (transformFillsToTransactions)
  2. Integration: Added to PerpsMarketDetailsView between the chart and navigation card sections

  3. Configuration: Added RECENT_ACTIVITY_LIMIT constant (value: 3) to perpsConfig.ts

  4. Localization: Added two new strings in en.json:

    • "perps.market.recent_trades": "Recent activity"
    • "perps.market.no_trades": "No recent activity"
  5. Testing: Comprehensive unit test file included with 657 lines testing all states and interactions

Impact Assessment:

  • Changes are isolated to the Perps feature area
  • No critical files modified (no Controllers, Engine, core, or E2E infrastructure)
  • Uses existing data fetching hooks and transformation utilities
  • Navigation flows remain within Perps feature (Activity screen, Position Transaction detail)
  • Well-tested with comprehensive unit tests
  • Changes are additive (new component) rather than modifying existing behavior

Risk Level: Low because:

  • Feature-specific UI changes only
  • No modifications to core functionality, data models, or business logic
  • Comprehensive unit tests included
  • Uses existing, stable hooks and utilities
  • No changes to critical paths or controllers

Test Selection: SmokePerps is sufficient because:

  • All changes are within the Perps feature domain
  • The new component integrates into existing Perps market details view
  • Tests should verify the recent trades list displays correctly on market detail screens
  • Navigation to Activity screen and transaction details should be tested
  • This is a contained feature addition with no cross-feature impact

View GitHub Actions results

@sonarqubecloud
Copy link

@michalconsensys michalconsensys added this pull request to the merge queue Nov 20, 2025
Merged via the queue into main with commit 27e3f35 Nov 20, 2025
158 of 160 checks passed
@michalconsensys michalconsensys deleted the feat/perps/recent-activity-market-detail branch November 20, 2025 16:47
@github-actions github-actions bot locked and limited conversation to collaborators Nov 20, 2025
@metamaskbot metamaskbot added the release-7.61.0 Issue or pull request that will be included in release 7.61.0 label Nov 20, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

release-7.61.0 Issue or pull request that will be included in release 7.61.0 size-L team-perps Perps team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants