feat(yields): mini swapper modal#11730
Conversation
…eature
- Replace generic "Exit" terminology with type-specific labels:
- "Unstake" for staking yields (native-staking, pooled-staking, etc.)
- "Withdraw" for vault/lending yields
- Add proper disabled state to exit button with tooltip explaining why
(no active position or no withdrawable amount)
- Show position card even without connected wallet with "Connect Wallet" button
- Display zeroed values maintaining consistent layout
- Add "Get {TOKEN}" button in Available to Deposit section when user has no balance
- Navigates to swapper with the token pre-selected as buy asset
- Add new i18n keys for type-specific success messages and loading states
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Show "Get {TOKEN}" button when user has no balance for yield input token
- Only display when wallet is connected
- Routes to /trade/{assetId} with buy asset pre-selected
- Store swapper modal implementation as .diffs for future use
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Create SwapperModal component wrapping StandaloneMultiHopTrade in a Dialog
- Use MemoryRouter for isolated routing within modal
- Clear Redux trade state on modal open/close
- Show modal when user clicks "Get {TOKEN}" button
- Supports desktop modal and mobile drawer via existing Dialog component
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
📝 WalkthroughWalkthroughAdds a modal-based swap flow for depositing yield assets, new translation keys, and numerous modal-aware additions to the multi-hop trade components to support modal styling and an on-swap broadcast callback. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant YieldAvailableToDeposit
participant SwapperModal
participant SwapperModalContent
participant StandaloneMultiHopTrade
participant tradeInput as tradeInput State
User->>YieldAvailableToDeposit: Click "Deposit Now"
YieldAvailableToDeposit->>YieldAvailableToDeposit: set isSwapperModalOpen = true
YieldAvailableToDeposit->>SwapperModal: open with defaultBuyAssetId
SwapperModal->>SwapperModalContent: mount inside MemoryRouter
SwapperModalContent->>tradeInput: dispatch clear()
SwapperModalContent->>tradeInput: set default buy/sell assets (if provided)
SwapperModalContent->>StandaloneMultiHopTrade: render trade UI (isModal=true, onSuccess)
User->>StandaloneMultiHopTrade: perform swap -> executeTrade
StandaloneMultiHopTrade->>useTradeExecution: broadcast SellTxHash
useTradeExecution->>SwapperModalContent: call onSwapTxBroadcast (if provided)
User->>SwapperModal: close modal (or onSuccess)
SwapperModal->>tradeInput: dispatch clear()
SwapperModal->>YieldAvailableToDeposit: onClose/onSuccess callback
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- YieldPositionCard: show zeroed position with Connect Wallet button instead of hiding - YieldAvailableToDeposit: properly handle Ledger read-only mode using established pattern Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…asset Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…at_swapper_modal # Conflicts: # src/pages/Yields/components/YieldAvailableToDeposit.tsx
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Resolved conflicts in: - YieldAvailableToDeposit.tsx: Keep SwapperModal integration - YieldSuccess.tsx: Use imported YieldSuccessMessageKey type from utils - main.json: Keep new translations (potentialEarningsAmount, depositNow, strategyInfo, overview) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…ompletion Thread an optional onSuccess callback through SwapperModal -> SwapperModalContent -> StandaloneMultiHopTrade -> TradeConfirm. When trade completes, the callback fires exactly once, allowing consumers like YieldAvailableToDeposit to auto-close the modal instead of requiring manual dismissal. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…dcast - Add modalCardStyles for seamless modal appearance (no nested borders) - Thread isModal prop through component chain to apply transparent styling - Change onSuccess callback to fire on swap TX broadcast (not trade completion) - Callback fires before navigation for cleaner modal close timing Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Fixed on both counts!
Tested mini-swapper here on desktop/mobile: https://jam.dev/c/244726b9-9182-4b10-ae0c-f768bcc86a5f And regression tested trade page swapper: https://jam.dev/c/1ba9eae5-54ce-4033-879e-79921a2b9472 And asset page: |


Description
Extracts swapper into a modal ("mini swapper") for the yield flow:
Issue (if applicable)
Stacked on #11729
Risk
Low - new modal component, no changes to existing swapper logic.
Testing
Engineering
Operations
Screenshots (if applicable)
https://jam.dev/c/d9cc0662-6c6d-4997-95b0-4840e2f01aee
Summary by CodeRabbit
New Features
Style
✏️ Tip: You can customize this high-level summary in your review settings.