Skip to content

feat: add token switch on Trade page#5583

Open
therealemjy wants to merge 2 commits into
mainfrom
feat/trade-switch
Open

feat: add token switch on Trade page#5583
therealemjy wants to merge 2 commits into
mainfrom
feat/trade-switch

Conversation

@therealemjy
Copy link
Copy Markdown
Member

Jira ticket(s)

VEN-1173

Changes

  • add token switch on Trade page

@therealemjy therealemjy requested a review from cuzz-venus May 12, 2026 09:03
@vercel
Copy link
Copy Markdown

vercel Bot commented May 12, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
dapp-preview Ready Ready Preview May 21, 2026 3:30pm
dapp-testnet Ready Ready Preview May 21, 2026 3:30pm
venus.io Ready Ready Preview May 21, 2026 3:30pm

Request Review

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 12, 2026

🦋 Changeset detected

Latest commit: afaa3af

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@venusprotocol/evm Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@greptile-apps
Copy link
Copy Markdown

greptile-apps Bot commented May 12, 2026

Greptile Summary

Adds a token-switch button to the Trade page's PairInfo component that swaps the selected long/short tokens by updating URL search params, and consolidates the CellGroup variants from three (primary, secondary, tertiary) down to two (primary, secondary), migrating all callsites accordingly.

  • A new switchSelectedTokens helper reads the current longToken/shortToken from the useTokenPair closure and writes swapped addresses back into the URL search params; a corresponding Vitest spec exercises the happy path.
  • The CellGroup variant refactor makes the old secondary (horizontal-scroll) behaviour the new primary default and repurposes secondary for the two-column grid, removing tertiary entirely and updating every callsite in the dashboard, markets, vaults, and trade position views.

Confidence Score: 5/5

Safe to merge — all changes are additive UI work with no effect on data fetching, smart-contract calls, or auth flows.

The token-switch logic correctly reads from and writes to URL search params, test coverage was added for the new behaviour, and the CellGroup variant consolidation was a deliberate refactor with every callsite updated in the same PR.

No files require special attention.

Important Files Changed

Filename Overview
apps/evm/src/pages/Trade/PairInfo/index.tsx Adds switchSelectedTokens helper and a switch-icon button that swaps long/short tokens in URL search params; minor layout class cleanup.
apps/evm/src/components/Icon/icons/switch.tsx New SVG icon component using correct camelCase JSX props (strokeWidth, strokeLinecap, strokeLinejoin).
apps/evm/src/components/CellGroup/index.tsx Removes tertiary variant; reshuffles variant styles so the default primary is the former transparent horizontal-scroll layout and secondary becomes the 2-column grid.
apps/evm/src/pages/Trade/PairInfo/tests/index.spec.tsx Adds a new test verifying that clicking the switch button correctly swaps LONG and SHORT token search params.
apps/evm/src/components/Icon/icons/index.ts Registers the new switch icon; uses a reserved keyword as the export name, which is valid ECMAScript IdentifierName syntax and safe under the namespace-import pattern used by the Icon component.

Reviews (3): Last reviewed commit: "feat: add token switch to Trade page" | Re-trigger Greptile

Comment thread apps/evm/src/components/Icon/icons/switch.tsx
Comment thread apps/evm/src/pages/Trade/PairInfo/index.tsx
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 12, 2026

Coverage Report for ./apps/evm

Status Category Percentage Covered / Total
🔵 Lines 81.18% 45368 / 55880
🔵 Statements 81.18% 45368 / 55880
🔵 Functions 62.43% 650 / 1041
🔵 Branches 72.27% 5105 / 7063
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
apps/evm/src/components/CellGroup/index.tsx 100% 66.66% 100% 100%
apps/evm/src/components/Icon/icons/index.ts 98.98% 0% 100% 98.98% 1
apps/evm/src/components/Icon/icons/switch.tsx 100% 50% 100% 100%
apps/evm/src/containers/Layout/Header/MarketInfo/index.tsx 0% 0% 0% 0% 1-221
apps/evm/src/pages/Dashboard/Markets/Positions/Summary/index.tsx 93.33% 0% 100% 93.33% 111-119
apps/evm/src/pages/Dashboard/Overview/index.tsx 97.27% 74.5% 66.66% 97.27% 196, 227, 231, 262, 271-274
apps/evm/src/pages/Dashboard/Vaults/index.tsx 98.64% 42.85% 100% 98.64% 55
apps/evm/src/pages/Markets/Header/index.tsx 100% 0% 100% 100%
apps/evm/src/pages/Trade/PairInfo/index.tsx 95.65% 73.91% 100% 95.65% 135-136, 145-148, 181, 188
apps/evm/src/pages/Trade/Positions/PositionList/RowFooter/StatusTab/index.tsx 96.87% 0% 100% 96.87% 36
Generated in workflow #13505 for commit afaa3af by the Vitest Coverage Report Action

@therealemjy
Copy link
Copy Markdown
Member Author

@greptile

Comment thread apps/evm/src/components/CellGroup/index.tsx
@therealemjy
Copy link
Copy Markdown
Member Author

@greptile

@greptile-apps
Copy link
Copy Markdown

greptile-apps Bot commented May 18, 2026

Want your agent to iterate on Greptile's feedback? Try greploops.

Copy link
Copy Markdown
Contributor

@cuzz-venus cuzz-venus left a comment

Choose a reason for hiding this comment

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

/lgtm

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.

2 participants