Skip to content

feat: add VIEW DISPUTE button for dispute states in order details#323

Merged
grunch merged 1 commit into
mainfrom
button-view-dispute
Oct 7, 2025
Merged

feat: add VIEW DISPUTE button for dispute states in order details#323
grunch merged 1 commit into
mainfrom
button-view-dispute

Conversation

@Catrya

@Catrya Catrya commented Oct 2, 2025

Copy link
Copy Markdown
Member

closes #322

Add VIEW DISPUTE button that appears when orders are in dispute states (dispute-initiated-by-you,
dispute-initiated-by-peer, admin-took-dispute), and improve admin-took-dispute screen

  • Add viewDisputeButton localization for EN/ES/IT
  • Navigate to dispute details screen when pressed
  • Add Action.adminTookDispute to FSM with same actions as other dispute states
  • Ensure correct buttons appear for both seller and buyer roles

Improves UX by providing direct access to dispute details from order screen.

Now:
image

Also admin-took-dispute screen
Before:
image

Now:
image

Summary by CodeRabbit

  • New Features
    • Added a “VIEW DISPUTE” button on trade details when a dispute is active, enabling quick access to the dispute thread.
  • Improvements
    • Refined dispute action handling to better account for cases where an admin has taken over a dispute, ensuring clearer button display and flow.
  • Localization
    • Added translations for the new “VIEW DISPUTE” button in English, Spanish (VER DISPUTA), and Italian (VISUALIZZA DISPUTA).

  Add VIEW DISPUTE button that appears when orders are in dispute states (dispute-initiated-by-you,
  dispute-initiated-by-peer, admin-took-dispute).

  - Add viewDisputeButton localization for EN/ES/IT
  - Navigate to dispute details screen when pressed
  - Add Action.adminTookDispute to FSM with same actions as other dispute states
  - Ensure correct buttons appear for both seller and buyer roles

  Improves UX by providing direct access to dispute details from order screen.
@coderabbitai

coderabbitai Bot commented Oct 2, 2025

Copy link
Copy Markdown
Contributor

Walkthrough

Adds explicit adminTookDispute handling in order action mappings and introduces a dedicated VIEW DISPUTE button flow on the trade detail screen when a disputeId exists. Updates dispute action rendering to bypass standard actions in this state. Adds new localization key viewDisputeButton in English, Spanish, and Italian.

Changes

Cohort / File(s) Summary
Order action mapping
lib/features/order/models/order_state.dart
Mapped Action.adminTookDispute under Status.dispute for Role.seller and Role.buyer to specific action lists; removed from other grouped handling.
Trade detail UI: dispute button
lib/features/trades/screens/trade_detail_screen.dart
Added _buildViewDisputeButton and integrated it into _buildButtonRow when an active dispute with disputeId exists; adjusted action switch to treat adminTookDispute like other dispute-initiated states and exclude it from regular dispute actions.
Localization: new key
lib/l10n/intl_en.arb, lib/l10n/intl_es.arb, lib/l10n/intl_it.arb
Added viewDisputeButton strings: EN "VIEW DISPUTE", ES "VER DISPUTA", IT "VISUALIZZA DISPUTA".

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant U as User
  participant T as TradeDetailScreen
  participant S as OrderState
  participant R as Router/Navigator
  participant D as Dispute Screen

  U->>T: Open trade details
  T->>S: Read status/role/actions + disputeId
  alt dispute active AND disputeId present
    T->>U: Render VIEW DISPUTE button
    U->>T: Tap VIEW DISPUTE
    T->>R: Navigate to disputeId
    R->>D: Show Dispute Screen
  else no dispute or no disputeId
    T->>U: Render standard action buttons
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • grunch

Poem

A whisker twitch, a button bright—
“VIEW DISPUTE” gleams in tidy light.
From orders’ warren, straight we hop,
To burrows where the quarrels pop.
One click, no maze, we find the thread—
A carrot trail to peace instead. 🥕✨

Pre-merge checks and finishing touches

✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit's high-level summary is enabled.
Title Check ✅ Passed The pull request title concisely describes the main change: adding a VIEW DISPUTE button for dispute states in the order details screen, which aligns with the implemented feature.
Linked Issues Check ✅ Passed The changes introduce the VIEW DISPUTE button in all active dispute states, wire its navigation to the dispute details screen, and add corresponding localization entries, fully meeting issue #322’s requirements for direct access and UX improvement.
Out of Scope Changes Check ✅ Passed All modifications, including finite‐state updates, widget refactoring, and locale additions, directly support the VIEW DISPUTE feature without introducing unrelated functionality.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch button-view-dispute

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between af79d7e and 6d24c02.

📒 Files selected for processing (5)
  • lib/features/order/models/order_state.dart (2 hunks)
  • lib/features/trades/screens/trade_detail_screen.dart (3 hunks)
  • lib/l10n/intl_en.arb (1 hunks)
  • lib/l10n/intl_es.arb (1 hunks)
  • lib/l10n/intl_it.arb (1 hunks)
🧰 Additional context used
📓 Path-based instructions (7)
**/*.arb

📄 CodeRabbit inference engine (AGENTS.md)

Keep user-facing strings in localization ARB files; do not hard-code copy in Dart code

Files:

  • lib/l10n/intl_es.arb
  • lib/l10n/intl_it.arb
  • lib/l10n/intl_en.arb
lib/l10n/intl_{en,es,it}.arb

📄 CodeRabbit inference engine (CLAUDE.md)

Add new localization keys to all three ARB files (en, es, it)

Files:

  • lib/l10n/intl_es.arb
  • lib/l10n/intl_it.arb
  • lib/l10n/intl_en.arb
lib/l10n/*.arb

📄 CodeRabbit inference engine (CLAUDE.md)

For parameterized strings, include proper ARB metadata

Files:

  • lib/l10n/intl_es.arb
  • lib/l10n/intl_it.arb
  • lib/l10n/intl_en.arb
lib/features/**

📄 CodeRabbit inference engine (AGENTS.md)

Place feature-specific Dart code under lib/features// (screens, providers, widgets)

Files:

  • lib/features/trades/screens/trade_detail_screen.dart
  • lib/features/order/models/order_state.dart
**/*.dart

📄 CodeRabbit inference engine (AGENTS.md)

**/*.dart: Format code with the Dart formatter (two-space indentation, trailing commas where beneficial)
Keep the analyzer (flutter_lints) at zero warnings across the codebase

**/*.dart: All code comments must be in English
Use clear, concise English for variable and function names
Maintain zero flutter analyze issues
Use latest Flutter/Dart APIs (e.g., prefer withValues() over withOpacity())
Remove unused imports and dependencies

Files:

  • lib/features/trades/screens/trade_detail_screen.dart
  • lib/features/order/models/order_state.dart
lib/features/**/*.dart

📄 CodeRabbit inference engine (AGENTS.md)

Name Riverpod providers as Provider or Notifier within their feature directory

Files:

  • lib/features/trades/screens/trade_detail_screen.dart
  • lib/features/order/models/order_state.dart
lib/**/*.dart

📄 CodeRabbit inference engine (CLAUDE.md)

lib/**/*.dart: Use post-frame callbacks for UI side effects (e.g., SnackBars/dialogs)
Use S.of(context).keyName for all user-facing strings (no hardcoded text)
Always use localized strings instead of hardcoded text
Pass BuildContext to methods that need localization (use S.of(context))
Check mounted before using BuildContext after async gaps
Use const constructors where possible

Files:

  • lib/features/trades/screens/trade_detail_screen.dart
  • lib/features/order/models/order_state.dart
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build
🔇 Additional comments (11)
lib/l10n/intl_es.arb (1)

542-542: LGTM!

The Spanish localization for the VIEW DISPUTE button is correctly added and properly translated.

lib/l10n/intl_it.arb (1)

571-571: LGTM!

The Italian localization for the VIEW DISPUTE button is correctly added and properly translated.

lib/features/order/models/order_state.dart (2)

423-427: LGTM!

The adminTookDispute action mapping for sellers is correctly defined with appropriate actions (sendDm, cancel, release) that align with the seller's role responsibilities during dispute resolution.


547-550: LGTM!

The adminTookDispute action mapping for buyers is correctly defined with appropriate actions (sendDm, cancel) that align with the buyer's role during dispute resolution. Note that buyers correctly lack the release action compared to sellers.

lib/l10n/intl_en.arb (1)

619-619: LGTM!

The English localization for the VIEW DISPUTE button is correctly added with clear, concise text.

lib/features/trades/screens/trade_detail_screen.dart (6)

271-272: LGTM!

The comment clearly documents that VIEW DISPUTE button handling has been moved to _buildButtonRow, improving code clarity.


346-350: LGTM!

The adminTookDispute case is correctly grouped with other dispute initiation actions and properly breaks to prevent duplicate button generation. The comment clearly explains the independent handling approach.


354-361: LGTM!

The exclusion of adminTookDispute in the dispute button rendering logic is correct and prevents users from initiating a new dispute when an admin has already taken the existing one.


771-781: LGTM!

The new _buildViewDisputeButton helper is well-structured with proper localization, consistent styling, and correct navigation to the dispute details screen.


788-795: LGTM!

The VIEW DISPUTE button logic correctly checks for dispute states and validates the presence of a disputeId before adding the button. Good defensive programming with the null check.


797-797: LGTM!

The allButtons list is correctly updated to include extraButtons using the spread operator, maintaining proper button ordering (close, actions, then VIEW DISPUTE).


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.

@Catrya Catrya requested a review from grunch October 2, 2025 20:47

@AndreaDiazCorreia AndreaDiazCorreia left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

tACK

@grunch grunch left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@grunch grunch merged commit 6a1d667 into main Oct 7, 2025
2 checks passed
@grunch grunch deleted the button-view-dispute branch October 7, 2025 17:29
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.

Add "VIEW DISPUTE" button to order details when user has an open dispute

3 participants