Skip to content

feat(frontend): build guided dispute submission wizard — per-category evidence upload, browser-side SHA-256 integrity, IPFS CID preview, on-chain cost estimate, and auto-save draft #1541

Description

@Chibey-max

Overview

The existing dispute submission is a single form. Real disputes require structured evidence: screenshots, contracts, communication logs. A wizard guides the claimant through categorising their evidence, verifying file integrity, and previewing the on-chain cost before submitting.

What to build

  • 5-step wizard component DisputeSubmissionWizard:
    1. Context: select dispute type (non-delivery, quality, scope-creep, other); text description (min 100 chars, max 2000)
    2. Evidence upload: per-category upload slots — Contract Documents, Deliverable Screenshots, Communication Logs, Other; each slot accepts multiple files up to 20 MB each, max 10 files total
    3. Integrity verification: for each uploaded file, compute SHA-256 in the browser using the Web Crypto API; display the hash next to each file; allow user to copy individual hashes; show a warning if the same file is uploaded twice (hash collision detected)
    4. Review: summary of all evidence files with their hashes; preview of the IPFS CID that will be pinned (computed client-side as a CIDv1 SHA-256 multihash); on-chain submission cost estimate (from simulation sandbox, feat(frontend): implement client-side Soroban transaction simulation sandbox — dry-run before signing, fee breakdown, storage state diff, risk indicators, and pre-sign confirmation modal #1540)
    5. Submit: calls POST /api/v1/disputes with the evidence metadata and signed transaction; shows progress (IPFS pin → on-chain submission → confirmation)
  • Progress indicator at the top of the wizard with step labels; clicking a completed step navigates back
  • Auto-save: wizard state persisted to localStorage keyed by escrow ID; returning users see a "Continue your draft" banner
  • File validation: reject non-image, non-PDF, non-text files with a list of allowed MIME types shown in the upload zone

Acceptance Criteria

  • SHA-256 hash computed in browser using crypto.subtle.digest('SHA-256', ...) — no server round-trip
  • Duplicate file detection (same hash, different name) shows an inline warning but does not block submission
  • Total file count across all categories is capped at 10; adding an 11th shows a toast and blocks the upload
  • IPFS CID preview matches the actual CID after backend pinning (tested in integration)
  • Auto-save restores all form fields and the file list (file metadata, not the file bytes) from localStorage
  • Submission progress has three distinct visual states: IPFS pinning, on-chain tx pending, confirmed
  • Step navigation is keyboard accessible; steps are announced to screen readers via aria-current="step"
  • React Testing Library tests: file hash computation, duplicate detection, auto-save/restore, step progression

Technical notes

  • crypto.subtle is available in all modern browsers; no polyfill needed
  • File bytes are never stored in localStorage; only { name, size, type, sha256, category } metadata

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions