Skip to content

feat(client): add dispute open/resolve UI - #183

Merged
Dannyswiss1 merged 2 commits into
Cylo-Traders:masterfrom
LamsOfJos:feat/dispute-resolution-ui-145
Aug 29, 2026
Merged

feat(client): add dispute open/resolve UI#183
Dannyswiss1 merged 2 commits into
Cylo-Traders:masterfrom
LamsOfJos:feat/dispute-resolution-ui-145

Conversation

@LamsOfJos

Copy link
Copy Markdown
Contributor

Summary

Adds the missing UI for opening and resolving campaign disputes — previously the only path was calling open_dispute/resolve_dispute on the contract directly, even though both hooks already existed in useEscrowMutations.ts.

Closes #145

What was implemented

  • Open dispute: new OpenDisputeForm component using the existing useOpenDispute() hook, wired into CampaignDetailPage. Visible only when the connected wallet is the campaign's farmer, a contributing investor (useContribution > 0), or the escrow admin (useEscrowAdmin) — mirroring the contract's own .require_auth() boundary as a UX convenience, not the authorization boundary itself.
  • Resolve dispute: CampaignAdminPanel.tsx already had a ResolveDisputeForm wired to useResolveDispute(), covering all three resolution types (FullRefund / FullPayout / PartialSettlement), with the payout-amount field only required for PartialSettlement. Verified this satisfies the admin-side acceptance criterion as-is — no changes needed there.

Notes / scope

  • CampaignDetailPage still renders local mock campaign state (a separate, already-tracked gap — "once Issue 1 makes it real"). Added a farmer field to its mock CampaignData and kept OpenDisputeForm fully prop-driven so it drops in unchanged once the page is wired to real contract data.
  • An accessibility pass on the new UI (the issue's last checkbox) is not included here — recommend a follow-up once the component is exercised against real campaign data.

Testing

  • Added 7 tests in OpenDisputeForm.test.tsx (client/src/components/campaign/tests/), following the existing CampaignAdminPanel.test.tsx mocking pattern: wallet-not-connected, ineligible wallet (renders nothing), farmer/contributor/admin success paths, empty-reason validation, and contract-rejection error surfacing.
  • tsc -b, eslint, prettier, and vite build all pass for the changed/new files.
  • Full client suite: 68/70 passing. The 2 failures are in ActivityFeed.test.tsx, confirmed pre-existing on master via git stash — unrelated to this change.
  • Known pre-existing issue, not introduced here: npm run lint / npm run format:check currently fail repo-wide (~90 prettier errors in ActivityFeed.tsx, ActivityFeedItem.tsx, activityLabels.ts, registry.test.ts, ActivityFeedPage.tsx) — none of these files are touched by this PR, and the failures reproduce on a clean master checkout.

Files changed

  • client/src/components/campaign/OpenDisputeForm.tsx (new)
  • client/src/components/campaign/__tests__/OpenDisputeForm.test.tsx (new)
  • client/src/pages/CampaignDetailPage.tsx

@shinzoxD

Copy link
Copy Markdown

@LamsOfJos leaving #188 / #189 for after this PR. I mistakenly opened overlapping PRs that re-added OpenDisputeForm and closed them (#215, #216).

@Dannyswiss1
Dannyswiss1 merged commit 0d97a2f into Cylo-Traders:master Aug 29, 2026
1 check failed
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.

No UI exists for opening or resolving disputes

3 participants