feat: improve price impact row and warnings#26390
Conversation
|
CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes. |
GeorgeGkas
left a comment
There was a problem hiding this comment.
This is part of a bigger epic will be included two releases from now. Please do not merge yet.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
bfullam
left a comment
There was a problem hiding this comment.
Some minor AC checks. Otherwise, looks great!
🔍 Smart E2E Test Selection
click to see 🤖 AI reasoning detailsE2E Test Selection:
The changes are focused on the Bridge/Swap flow which is covered by SmokeTrade. Since bridge transactions require confirmations and the PR modifies the confirmation flow (adding a price impact check that can block transactions), SmokeConfirmations should also be selected as per the tag description guidance. The risk is medium because:
Performance Test Selection: |
The committed fixture schema is out of date. To update, comment: |
| }: PriceImpactDescriptionProps) { | ||
| const isWarning = Boolean(priceImpact); | ||
|
|
||
| const body = useMemo(() => { |
There was a problem hiding this comment.
We should avoid using memoizing callbacks for logic that's not expensive. For example, this one can simply become:
let body = strings('bridge.price_impact_info_description');
if (type === PriceImpactModalType.Execution) {
body = strings('bridge.price_impact_execution_description', {
priceImpact: priceImpact ?? '0',
});
} else if (isWarning) {
body = strings('bridge.price_impact_warning_description', {
priceImpact: priceImpact ?? '0',
});
}
|



Description
Previously, the price impact value color was driven by a warning boolean and effectively rendered as default or red. This change updates the value color by threshold so the UI communicates risk levels more clearly:
>= 5%shows warning color (yellow)>= 25%shows error color (red)Changelog
CHANGELOG entry: Updated swap price impact text coloring.
Related issues
Fixes: https://consensyssoftware.atlassian.net/browse/SWAPS-4020 https://consensyssoftware.atlassian.net/browse/SWAPS-4024
Manual testing steps
Screenshots/Recordings
Before
Price impact value color only switched between default and red.
After
Price impact value color now maps to thresholds:
< 5%>= 5%>= 25%Pre-merge author checklist
Pre-merge reviewer checklist
Note
Medium Risk
Changes the Bridge confirmation flow to conditionally gate execution behind a new price-impact modal and adds navigation resets on quote expiry, which can affect swap completion and modal routing. Risk is mitigated by extensive new unit tests but touches user-critical transaction submission UX.
Overview
Adds a new
PriceImpactModal(with header/description/footer) and wires it into Bridge modal routes, including new i18n copy for info, warning, and high price impact states.Updates
QuoteDetailsCardto always show a Price impact row with an info button that opens the modal, and switches price-impact coloring/iconography to threshold-based view data (warning at>=5%, error at>=25%) plus safer formatting for missing/invalid/negative values.Refactors swap submission by introducing
useBridgeConfirmand updatingSwapsConfirmButtonto accept/forward an explicit analyticslocation; if price impact meets the error threshold it now navigates to the modal (Executiontype) instead of submitting immediately. AddsuseModalCloseOnQuoteExpiryand applies it across Bridge modals to reset the modal stack toQuoteExpiredModalwhen quotes expire.Written by Cursor Bugbot for commit 3941641. This will update automatically on new commits. Configure here.