Skip to content

feat(buy-sell): add Buy/Sell/Swap segmented mode switcher - #256

Open
joshuakrueger-dfx wants to merge 10 commits into
developfrom
feat/trade-mode-tabs
Open

feat(buy-sell): add Buy/Sell/Swap segmented mode switcher#256
joshuakrueger-dfx wants to merge 10 commits into
developfrom
feat/trade-mode-tabs

Conversation

@joshuakrueger-dfx

@joshuakrueger-dfx joshuakrueger-dfx commented Aug 27, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Adds TradeModeTabs, a segmented control (Kaufen/Verkaufen/Tauschen) at the top of the amount step in Buy and Sell, matching the DFX web widget's (app2) .seg/.panels structure and using the app's own lightColors tokens.
  • Adds the feature-gated /(auth)/swap placeholder route and makes it reachable from the shared trade tabs.
  • Aligns the Swap shell with Buy/Sell: shared dashboard background in light and dark themes, shared Typography tokens, and localized title/coming-soon copy.
  • Adds the route to the README feature matrix and records a real visual baseline for the deterministic placeholder state.

Verified

  • npm test -- --coverage: 109 suites, 1398 tests passed; 99.83% lines, 93.03% branches, 99.78% functions.
  • npm run check: typecheck and format passed; lint passed with 0 errors (repository has existing warnings).
  • node scripts/check-coverage-floor.mjs: scoped line coverage 99.83% (floor 99%).
  • node scripts/check-coverage-file-floors.mjs: all 15 Tier-A files meet their floors.
  • node scripts/check-feature-matrix.mjs: 67 referenced paths, 17 flags, 38 screens documented.
  • node scripts/check-visual-coverage.mjs and --self-test: 38 routes accounted for; 13 self-test cases passed.
  • Lockfile lint, npm audit policy, WDK worklet bundle, both CI bundle variants, CodeQL, typecheck, lint, format, test, coverage-floor, matrix, and visual-coverage checks passed on eb09942ae51d.
  • A local iOS Release Detox run reached the new Buy → Sell → Swap flow and captured e2e/__baselines__/trade-mode-swap.png; the full authenticated visual file also exercises pre-existing wallet/auth flows that are not deterministic on this local simulator.

Scope and evidence

Symptom (verbatim): matrix-check: screen app/(auth)/swap/index.tsx is not referenced anywhere in the README feature matrix; visual-coverage: screen (auth)/swap/index.tsx has no entry in e2e/visual-coverage.json.

Scale: 19 changed files, +667/−38 lines from the merge-base; the change is limited to trade tabs/swap UI, its tests, documentation, and one captured visual baseline.

Smaller fix considered: Updating only the matrix and visual manifest would clear the two CI failures but would leave Swap visually inconsistent with Buy/Sell and without an E2E navigation assertion, so the shared shell and focused tests were updated together.

Not done here (follow-up)

  • Swap remains a UI placeholder; backend DTOs, quote logic, and a mocked backend fixture are follow-up work.
  • Maestro/native E2E could not be independently verified on this workstation; GitHub's draft-gated native jobs will run once the PR is ready.

Final pass (eb09942): Required GitHub checks are green on this SHA; mergeability is MERGEABLE; no reviews or comments are open. No merge or auto-merge is requested.

The wallet's local FeeDto type only declared rate/fixed/network/min/dfx/
total, missing bank/bankFixed/bankVariable/platform/networkStart that
the DFX API's FeeDto already sends (api/.../fee.dto.ts). The bank fee
was silently unreadable in the app despite being in every response.
Purely additive: PrimaryButton's new icon prop is optional, existing
callers are unaffected.
- Presets fixed to 50/100/250/500, moved above the amount input
- Quote card collapsed by default: shield icon, effective rate
  ('1 {asset} ~ {price} {currency} incl. fees', using exchangeRate
  directly - verified against the amount/estimatedAmount ratio in the
  quote fixtures, not just the field name), fee-total badge, chevron
- Bank fee row added now that FeeDto carries it
- 'You receive' row highlighted in the accent color
- Static SEPA payment-method row above the CTA (Buy only)
- CTA now names the target asset with a trailing arrow icon

Buy and Sell mirror each other except presets and the payment-method
row, which are Buy-only by design (Sell trades a crypto amount, not a
fiat preset, and has no payment-method choice before confirming).
BuyScreenImpl's CTA test now expects 'buy.title BTC' instead of the old
common.continue placeholder; Icon and PrimaryButton get coverage for
the new arrow-right variant and icon slot.
Verifies the icon prop is truly additive (absent by default, hidden
during loading) instead of only asserting both texts render.
Adds a TradeModeTabs segmented control (Kaufen/Verkaufen/Tauschen) at
the top of the amount step in Buy and Sell, matching the structure of
the DFX web widget (app2) while using the app's own light-theme
tokens. Adds a new Swap placeholder route/screen ("coming soon") so
all three modes are reachable and switchable, ahead of the real Swap
backend wiring in a follow-up PR.
@joshuakrueger-dfx
joshuakrueger-dfx marked this pull request as ready for review September 1, 2026 13:53
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