Skip to content

Feat/add escrow trade status#326

Open
mariocodecr wants to merge 2 commits into
Kaizenode:mainfrom
mariocodecr:feat/addEscrowTradeStatus
Open

Feat/add escrow trade status#326
mariocodecr wants to merge 2 commits into
Kaizenode:mainfrom
mariocodecr:feat/addEscrowTradeStatus

Conversation

@mariocodecr

Copy link
Copy Markdown
Contributor

📝 (feat: add Escrow / Trade Status screen with lifecycle stepper)

🛠️ Issue

📖 Description

Adds the Escrow / Trade Status screen at app/trades/[id]/page.tsx — a mobile-first view that renders the Trustless Work escrow lifecycle (Iniciado →
Financiado → Liberado, with a Disputa branch) using a new reusable EscrowStepper component. Each step exposes four visual states (completed, current,
pending, disputed) mapped to the brand's semantic tokens, so it adapts to light and dark themes without hardcoded colors. The screen surfaces a summary
header (amount, counterparty via WalletBadge, contract-id placeholder) and a context-aware primary CTA derived from the current step, plus a secondary
"Abrir disputa" action — both wired to console.log stubs per the issue scope.

UI / mock only. No Trustless Work API calls, no backend, no changes to files outside the declared scope.

✅ Changes made

  • New reusable component — p2p-safe-swap/frontend/components/trade/escrow-stepper.tsx
    • Data-driven vertical stepper (steps: EscrowStep[]) — reusable for future trade flows.
    • Four semantic step states with token-based styling:
      • completed → bg-primary text-primary-foreground (check)
      • current → bg-primary/15 text-primary ring-2 ring-primary/40 (animated spinner)
      • pending → border-border text-muted-foreground (muted circle)
      • disputed → bg-destructive/15 text-destructive (warning)
    • Semantic markup:
        /
      1. , aria-current="step", , sr-only status labels.
      2. Timestamps formatted via Intl.DateTimeFormat with overrideable locale (default es-AR).
      3. Vertical rail between steps colored by completion (bg-primary vs bg-border).
  • New route — p2p-safe-swap/app/trades/[id]/page.tsx
    • Client component using React.use(params) (Next 16 async params) — dynamic [id] accepts any trade id.
    • Header with functional back button (router.back()) + centered title "Estado de la operación".
    • Summary card: WalletBadge + counterparty name + short address + amount (tabular-nums) + USDC + contract-id placeholder with ShieldCheck icon.
    • Stepper card rendering the mocked lifecycle (initiated completed → funded current → released pending).
    • Context-aware primary CTA derived from the current step (initiated → "Financiar escrow", funded → "Liberar fondos") + secondary danger "Abrir
      disputa".
    • Full content wrapped in for a subtle entrance that honors prefers-reduced-motion.
    • Mobile-first layout matching the rest of the app (mx-auto max-w-md bg-background).
    • Reuses existing components: Button, WalletBadge, Reveal; icons from lucide-react; classes composed via cn.
    • Copy follows the surrounding Spanish convention ("Volver", "Iniciado", "Financiado", "Liberado").

🖼️ Media (screenshots/videos)

Screenshot 2026-07-16 at 10 38 00 PM Screenshot 2026-07-16 at 10 38 17 PM

📜 Additional Notes

  • Definition of Done verified locally
    • npx tsc --noEmit → clean
    • npm run lint (ESLint) → clean
    • Dev server (npm run dev) → GET /trades/demo-123 returns 200, page renders in both themes.
  • Scope discipline — only the two files declared in the issue are added; nothing else in the repo is modified (no changes to package.json, tokens,
    existing components, etc.).
  • Atomic commits — split intentionally so each compiles standalone and is bisect-friendly:
    a. feat: add reusable escrow lifecycle stepper component — building block.
    b. feat: add trade status screen at /trades/[id] — consumer.
  • Accessibility — semantic list, aria-current on the active step, sr-only status labels for screen readers, for machine-readable
    timestamps, focusable back button with aria-label and visible focus ring, disabled state on secondary action when no step is active.
  • Testing — no automated tests added in this PR; the repo currently has no test infrastructure for the frontend and adding it is out of scope for this
    issue. Manual test steps:
    • Navigate to http://localhost:3000/trades/anything — screen renders with mock trade.
    • Toggle theme (bottom-right) — both themes look correct.
    • Click primary CTA → console shows [escrow] primary action: { tradeId, action: "release" }.
    • Click "Abrir disputa" → console shows [escrow] dispute opened { tradeId }.
    • Enable macOS "Reduce motion" → entrance animation is skipped, content still renders.

Introduces a data-driven vertical stepper that renders the Trustless
Work escrow lifecycle (initiated → funded → released, with a disputed
branch). Each step supports four visual states — completed, current,
pending, disputed — mapped to semantic brand tokens so it adapts to
light and dark themes without hardcoded colors.

Timestamps are formatted with Intl and the list uses semantic markup
(<ol>, <time dateTime>, aria-current) plus sr-only status labels for
assistive tech.
Adds a mobile-first screen that renders an escrow trade lifecycle
using the new EscrowStepper. Includes a summary header with
counterparty (WalletBadge), amount and a contract-id placeholder, plus
a context-aware primary action derived from the current step
("Financiar escrow" / "Liberar fondos") and a secondary "Abrir
disputa" action — both wired to console.log stubs per the issue scope.

Uses mocked trade state only; no Trustless Work API calls. Content is
wrapped in <Reveal> for a subtle entrance that honors
prefers-reduced-motion, and copy follows the existing Spanish
convention (Volver, Iniciado, Financiado, Liberado).
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.

[FEAT]: Add the Escrow / Trade Status screen (lifecycle stepper)

1 participant