Skip to content

feat(us12): phase 11 — My Trades screen, list item, providers - #61

Merged
grunch merged 3 commits into
mainfrom
005-mostro-p2p-client
Mar 30, 2026
Merged

feat(us12): phase 11 — My Trades screen, list item, providers #61
grunch merged 3 commits into
mainfrom
005-mostro-p2p-client

Conversation

@grunch

@grunch grunch commented Mar 30, 2026

Copy link
Copy Markdown
Member
  • Implement lib/features/trades/screens/trades_screen.dart: AppBar with menu +
    Mostro logo + notification bell, My Trades sub-header, status filter
    dropdown (PopupMenuButton with all TradeStatusFilter values), sorted list
    of TradesListItem, empty state with bolt icon, wired to /order_book route
  • Implement lib/features/trades/widgets/trades_list_item.dart: card with
    selling/buying title, colored status chip + role chip (creator/taker),
    bank icon + fiat amount + time-ago + payment method, chevron, tap → trade
    detail; _timeAgo helper; status→chip color mapping (Pending=yellow,
    Active/FiatSent=blue, Success=green, Canceled=gray, Dispute=red)
  • Implement lib/features/trades/providers/trades_providers.dart:
    TradeListItem model, TradeStatusFilter enum, TradeRole enum,
    selectedStatusFilterProvider (StateProvider), filteredTradesWithOrderState-
    Provider (sorted newest-first, empty until bridge wired),
    orderBookNotificationCountProvider (0 until bridge wired)
  • Wire /order_book route to TradesScreen in app_routes.dart (replaces stub)
  • Mark T082, T083, T084 [x] in tasks.md

Summary by CodeRabbit

  • New Features
    • Launched "My Trades" screen with a status filter and empty-state guidance
    • Trade list items show direction (buy/sell), status, role, fiat amount/currency, payment method, and timestamp
  • Bug Fixes
    • App route now navigates to the real My Trades screen instead of a placeholder
    • Bottom navigation badge initialized to zero
  • Documentation
    • Marked related implementation tasks as completed in project specs

grunch added 2 commits March 30, 2026 11:27
- Implement lib/features/trades/screens/trades_screen.dart: AppBar with menu +
  Mostro logo + notification bell, My Trades sub-header, status filter
  dropdown (PopupMenuButton with all TradeStatusFilter values), sorted list
  of TradesListItem, empty state with bolt icon, wired to /order_book route
- Implement lib/features/trades/widgets/trades_list_item.dart: card with
  selling/buying title, colored status chip + role chip (creator/taker),
  bank icon + fiat amount + time-ago + payment method, chevron, tap → trade
  detail; _timeAgo helper; status→chip color mapping (Pending=yellow,
  Active/FiatSent=blue, Success=green, Canceled=gray, Dispute=red)
- Implement lib/features/trades/providers/trades_providers.dart:
  TradeListItem model, TradeStatusFilter enum, TradeRole enum,
  selectedStatusFilterProvider (StateProvider), filteredTradesWithOrderState-
  Provider (sorted newest-first, empty until bridge wired),
  orderBookNotificationCountProvider (0 until bridge wired)
- Wire /order_book route to TradesScreen in app_routes.dart (replaces stub)
- Mark T082, T083, T084 [x] in tasks.md
… skew guard

- Clarify TradesScreen doc comment: reference AppRoute.orderBook by name so
  the path is self-documenting rather than repeating the string literal
- Guard _timeAgo against negative Duration from future timestamps (clock skew):
  treat any negative diff as "just now" so the output is never "-X minutes ago"
@coderabbitai

coderabbitai Bot commented Mar 30, 2026

Copy link
Copy Markdown
Contributor

Caution

Review failed

Pull request was closed or merged during review

Walkthrough

Adds a new "My Trades" feature: a TradesScreen UI, TradesListItem widget, and Riverpod providers for trade filtering and notification count; wires TradesScreen into app routes and updates task checklist documentation.

Changes

Cohort / File(s) Summary
Route Integration
lib/core/app_routes.dart
Replaced AppRoute.orderBook stub with TradesScreen and added its import.
Trade Providers & Models
lib/features/trades/providers/trades_providers.dart
New file: TradeStatusFilter and TradeRole enums, immutable TradeListItem model, selectedStatusFilterProvider (StateProvider), filteredTradesWithOrderStateProvider (Provider, currently returns empty list), and orderBookNotificationCountProvider (Provider returning 0).
Trade UI Components
lib/features/trades/screens/trades_screen.dart, lib/features/trades/widgets/trades_list_item.dart
Added TradesScreen (ConsumerWidget) with AppBar, status filter popup, empty state, ListView of trades, and bottom nav; added TradesListItem widget rendering trade card, chips, time-ago, and navigation to trade detail.
Documentation
specs/004-mostro-p2p-client/tasks.md
Marked tasks T082, T083, and T084 as completed (checkbox updates).

Sequence Diagram

sequenceDiagram
    participant User
    participant TradesScreen
    participant StatusFilterButton
    participant SelectedFilterProvider
    participant FilteredTradesProvider
    participant ListView

    User->>StatusFilterButton: Tap to open filter
    StatusFilterButton->>User: Show popup menu
    User->>StatusFilterButton: Choose filter value
    StatusFilterButton->>SelectedFilterProvider: Update filter state
    SelectedFilterProvider->>FilteredTradesProvider: Notify state change
    FilteredTradesProvider->>TradesScreen: Emit filtered trades list
    TradesScreen->>ListView: Rebuild with new list
    ListView->>User: Display updated trades
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

Poem

🐰 I hopped through routes and fields of code,
I nudged a stub where real trades grow.
Filters flutter, chips all gleam,
A tiny rabbit's routing dream—
Hooray, the trades are on the show! 🥕✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly and clearly summarizes the main change: implementation of the My Trades screen, list item widget, and providers. It is concise and specific, avoiding vague terms.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch 005-mostro-p2p-client

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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

🧹 Nitpick comments (1)
lib/features/trades/widgets/trades_list_item.dart (1)

146-156: Consider adding a comment for the all case.

TradeStatusFilter.all is a filter option, not an actual trade status. While the fallback to statusInactive is reasonable, a brief comment would clarify this is a defensive case that shouldn't occur in practice.

📝 Suggested clarification
       TradeStatusFilter.canceled => AppColors.statusInactive,
       TradeStatusFilter.dispute => AppColors.statusDispute,
+      // `all` is a filter option, not a real status; fallback defensively.
       TradeStatusFilter.all => AppColors.statusInactive,
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@lib/features/trades/widgets/trades_list_item.dart` around lines 146 - 156,
Add a short clarifying comment for the defensive `all` branch inside the
_statusColors function: next to the TradeStatusFilter.all case, note that `all`
is a filter (not a real trade status) and that returning
AppColors.statusInactive is a fallback that "shouldn't occur in practice" to
make intent explicit; update the comment near
_statusColors/TradeStatusFilter.all so reviewers know this is defensive handling
rather than a real mapped status.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@lib/features/trades/widgets/trades_list_item.dart`:
- Around line 146-156: Add a short clarifying comment for the defensive `all`
branch inside the _statusColors function: next to the TradeStatusFilter.all
case, note that `all` is a filter (not a real trade status) and that returning
AppColors.statusInactive is a fallback that "shouldn't occur in practice" to
make intent explicit; update the comment near
_statusColors/TradeStatusFilter.all so reviewers know this is defensive handling
rather than a real mapped status.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: bf906df4-000c-4827-87c1-f2917967c039

📥 Commits

Reviewing files that changed from the base of the PR and between 7123302 and 34a9720.

📒 Files selected for processing (5)
  • lib/core/app_routes.dart
  • lib/features/trades/providers/trades_providers.dart
  • lib/features/trades/screens/trades_screen.dart
  • lib/features/trades/widgets/trades_list_item.dart
  • specs/004-mostro-p2p-client/tasks.md

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant