Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
d265d3b
fix: improve yield UI terminology, button states, and add Get Asset f…
gomesalexandre Jan 19, 2026
178f053
Merge origin/develop into feat_yield_final_polish
gomesalexandre Jan 19, 2026
8a55116
feat(yields): add "Get Asset" button to redirect users to trade page
gomesalexandre Jan 19, 2026
8768bc8
feat(yields): add SwapperModal for in-context asset acquisition
gomesalexandre Jan 19, 2026
b07d740
Merge remote-tracking branch 'origin/develop' into feat_yield_final_p…
gomesalexandre Jan 19, 2026
578950d
chore: remove diff files
gomesalexandre Jan 19, 2026
dcceb87
fix: show My Position card with Connect Wallet when no wallet connected
gomesalexandre Jan 19, 2026
cd8661d
fix: add missing yieldXYZ.getAsset translation
gomesalexandre Jan 19, 2026
b1c7bf2
docs: add i18n workflow note to CLAUDE.md
gomesalexandre Jan 19, 2026
9d13a59
fix: use useTradeNavigation for Get Asset button to properly set buy …
gomesalexandre Jan 19, 2026
8ac3cbd
Merge remote-tracking branch 'origin/feat_yield_final_polish' into fe…
gomesalexandre Jan 19, 2026
bd8e0d9
fix: simplify SwapperModal - remove header on desktop, keep on mobile
gomesalexandre Jan 19, 2026
ce56a1b
fix: use isCompact mode for SwapperModal to show single-column view
gomesalexandre Jan 19, 2026
3523ced
chore: remove unnecessary barrel file
gomesalexandre Jan 19, 2026
b7d68cb
chore: resolve merge conflicts from develop squash merge
gomesalexandre Jan 20, 2026
1775843
feat(swapper-modal): add onSuccess callback for auto-close on trade c…
gomesalexandre Jan 20, 2026
6443150
feat(swapper-modal): add modal styling and fire callback on swap broa…
gomesalexandre Jan 20, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/assets/translations/en/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -2819,7 +2819,11 @@
"otherYields": "Other %{symbol} Yields",
"availableToDeposit": "Available to Deposit",
"availableToDepositTooltip": "This is the amount of %{symbol} in your wallet that you can deposit into this yield opportunity.",
"getAsset": "Get %{symbol}"
"getAsset": "Get %{symbol}",
"potentialEarningsAmount": "%{amount}/yr at %{apy}% APY",
"depositNow": "Deposit Now",
"strategyInfo": "Strategy Info",
"overview": "Overview"
},
"earn": {
"enterFrom": "Enter from",
Expand Down
21 changes: 17 additions & 4 deletions src/components/MultiHopTrade/StandaloneMultiHopTrade.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,10 @@ import {
import { tradeInput } from '@/state/slices/tradeInputSlice/tradeInputSlice'
import { useAppDispatch, useAppSelector } from '@/state/store'

export type StandaloneTradeCardProps = TradeCardProps
export type StandaloneTradeCardProps = TradeCardProps & {
onSuccess?: () => void
isModal?: boolean
}

const GetTradeRates = () => {
useGetTradeRates()
Expand All @@ -38,7 +41,9 @@ export const StandaloneMultiHopTrade = memo(
defaultSellAssetId,
isCompact,
onChangeTab,
onSuccess,
isStandalone,
isModal,
}: StandaloneTradeCardProps) => {
const dispatch = useAppDispatch()
const location = useLocation()
Expand Down Expand Up @@ -129,7 +134,9 @@ export const StandaloneMultiHopTrade = memo(
<StandaloneTradeRoutes
isCompact={isCompact}
onChangeTab={onChangeTab}
onSuccess={onSuccess}
isStandalone={isStandalone}
isModal={isModal}
/>
)
},
Expand All @@ -138,11 +145,13 @@ export const StandaloneMultiHopTrade = memo(
type StandaloneTradeRoutesProps = {
isCompact?: boolean
isStandalone?: boolean
isModal?: boolean
onChangeTab: (newTab: TradeInputTab) => void
onSuccess?: () => void
}

const StandaloneTradeRoutes = memo(
({ isCompact, isStandalone, onChangeTab }: StandaloneTradeRoutesProps) => {
({ isCompact, isStandalone, isModal, onChangeTab, onSuccess }: StandaloneTradeRoutesProps) => {
const location = useLocation()

const tradeInputRef = useRef<HTMLDivElement | null>(null)
Expand All @@ -165,7 +174,10 @@ const StandaloneTradeRoutes = memo(
}, [location.pathname])

// Create memoized elements for each route
const tradeConfirmElement = useMemo(() => <TradeConfirm isCompact={isCompact} />, [isCompact])
const tradeConfirmElement = useMemo(
() => <TradeConfirm isCompact={isCompact} isModal={isModal} onSuccess={onSuccess} />,
[isCompact, isModal, onSuccess],
)

const verifyAddressesElement = useMemo(() => <VerifyAddresses />, [])

Expand All @@ -192,12 +204,13 @@ const StandaloneTradeRoutes = memo(
() => (
<TradeInput
isCompact={isCompact}
isModal={isModal}
tradeInputRef={tradeInputRef}
onChangeTab={onChangeTab}
isStandalone={isStandalone}
/>
),
[isCompact, onChangeTab, isStandalone],
[isCompact, isModal, onChangeTab, isStandalone],
)

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type { CardFooterProps } from '@chakra-ui/react'
import { Card, CardBody, CardFooter, CardHeader, Heading } from '@chakra-ui/react'
import type { JSX } from 'react'

import { cardstyles } from '../../const'
import { cardstyles, modalCardStyles } from '../../const'
import { WithBackButton } from '../WithBackButton'

import { TradeSlideTransition } from '@/components/MultiHopTrade/TradeSlideTransition'
Expand All @@ -15,6 +15,7 @@ type SharedConfirmProps = {
onBack: () => void
headerTranslation: TextPropTypes['translation']
isLoading?: boolean
isModal?: boolean
}

const cardMinHeight = { base: 'calc(100vh - var(--mobile-nav-offset))', md: 'initial' }
Expand All @@ -25,10 +26,17 @@ export const SharedConfirm = ({
footerContent,
onBack,
headerTranslation,
isModal,
}: SharedConfirmProps) => {
return (
<TradeSlideTransition>
<Card flex={1} width='full' maxWidth='500px' minHeight={cardMinHeight} {...cardstyles}>
<Card
flex={1}
width='full'
maxWidth='500px'
minHeight={cardMinHeight}
{...(isModal ? modalCardStyles : cardstyles)}
>
<CardHeader px={6} pt={4} borderTop={'none'}>
<WithBackButton onBack={onBack}>
<Heading textAlign='center' fontSize='md'>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type { CardProps } from '@chakra-ui/react'
import { Box, Card, Center, Flex, useMediaQuery } from '@chakra-ui/react'
import type { FormEvent, JSX } from 'react'

import { cardstyles } from '../../const'
import { cardstyles, modalCardStyles } from '../../const'
import { SharedTradeInputHeader } from '../SharedTradeInput/SharedTradeInputHeader'
import { useSharedWidth } from '../TradeInput/hooks/useSharedWidth'

Expand Down Expand Up @@ -32,6 +32,7 @@ type SharedTradeInputProps = {
onChangeTab: (newTab: TradeInputTab) => void
onSubmit: (e: FormEvent<unknown>) => void
isStandalone?: boolean
isModal?: boolean
}

const cardBorderRadius = { base: '0', md: '2xl' }
Expand All @@ -53,6 +54,7 @@ export const SharedTradeInput: React.FC<SharedTradeInputProps> = ({
onChangeTab,
onSubmit,
isStandalone,
isModal,
}) => {
const [isSmallerThanMd] = useMediaQuery(`(max-width: ${breakpoints.md})`, { ssr: false })
const [isSmallerThanXl] = useMediaQuery(`(max-width: ${breakpoints.xl})`, { ssr: false })
Expand All @@ -79,7 +81,7 @@ export const SharedTradeInput: React.FC<SharedTradeInputProps> = ({
borderRadius={cardBorderRadius}
minHeight={cardMinHeight}
height={!hasUserEnteredAmount && isSmallerThanMd ? cardMinHeight.base : 'initial'}
{...cardstyles}
{...(isModal ? modalCardStyles : cardstyles)}
>
<SharedTradeInputHeader
initialTab={tradeInputTab}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,13 @@ import { tradeQuoteSlice } from '@/state/slices/tradeQuoteSlice/tradeQuoteSlice'
import { TradeExecutionState } from '@/state/slices/tradeQuoteSlice/types'
import { useAppDispatch, useAppSelector } from '@/state/store'

export const TradeConfirm = ({ isCompact }: { isCompact: boolean | undefined }) => {
type TradeConfirmProps = {
isCompact?: boolean
isModal?: boolean
onSuccess?: () => void
}

export const TradeConfirm = ({ isCompact, isModal, onSuccess }: TradeConfirmProps) => {
const navigate = useNavigate()
const { isLoading } = useIsApprovalInitiallyNeeded()
const dispatch = useAppDispatch()
Expand Down Expand Up @@ -90,9 +96,18 @@ export const TradeConfirm = ({ isCompact }: { isCompact: boolean | undefined })
isCompact={isCompact}
tradeQuoteStep={tradeQuoteStep}
activeTradeId={activeTradeId}
onSwapTxBroadcast={onSuccess}
/>
)
}, [isTradeComplete, activeQuote, tradeQuoteLastHop, tradeQuoteStep, activeTradeId, isCompact])
}, [
isTradeComplete,
activeQuote,
tradeQuoteLastHop,
tradeQuoteStep,
activeTradeId,
isCompact,
onSuccess,
])

const isArbitrumBridgeWithdraw = useMemo(() => {
return isArbitrumBridgeTradeQuoteOrRate(activeQuote) && activeQuote.direction === 'withdrawal'
Expand Down Expand Up @@ -141,6 +156,7 @@ export const TradeConfirm = ({ isCompact }: { isCompact: boolean | undefined })
isLoading={isLoading}
onBack={handleBack}
headerTranslation={headerTranslation}
isModal={isModal}
/>
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,13 @@ type TradeConfirmFooterProps = {
tradeQuoteStep: TradeQuoteStep
activeTradeId: string
isCompact: boolean | undefined
onSwapTxBroadcast?: () => void
}

export const TradeConfirmFooter: FC<TradeConfirmFooterProps> = ({
tradeQuoteStep,
activeTradeId,
onSwapTxBroadcast,
}) => {
const [isExactAllowance, toggleIsExactAllowance] = useToggle(true)
const translate = useTranslate()
Expand Down Expand Up @@ -412,6 +414,7 @@ export const TradeConfirmFooter: FC<TradeConfirmFooterProps> = ({
activeTradeId={activeTradeId}
isExactAllowance={isExactAllowance}
isLoading={isNetworkFeeCryptoBaseUnitLoading || isNetworkFeeCryptoBaseUnitRefetching}
onSwapTxBroadcast={onSwapTxBroadcast}
/>
)
}, [
Expand All @@ -421,6 +424,7 @@ export const TradeConfirmFooter: FC<TradeConfirmFooterProps> = ({
isExactAllowance,
isNetworkFeeCryptoBaseUnitLoading,
isNetworkFeeCryptoBaseUnitRefetching,
onSwapTxBroadcast,
])

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ type TradeFooterButtonProps = {
activeTradeId: string
isExactAllowance: boolean
isLoading?: boolean
onSwapTxBroadcast?: () => void
}

export const TradeFooterButton: FC<TradeFooterButtonProps> = ({
Expand All @@ -64,6 +65,7 @@ export const TradeFooterButton: FC<TradeFooterButtonProps> = ({
activeTradeId,
isExactAllowance,
isLoading = false,
onSwapTxBroadcast,
}) => {
const [isSubmitting, setIsSubmitting] = useState(false)
const [shouldShowWarningAcknowledgement, setShouldShowWarningAcknowledgement] = useState(false)
Expand All @@ -76,6 +78,7 @@ export const TradeFooterButton: FC<TradeFooterButtonProps> = ({
currentHopIndex,
activeTradeId,
isExactAllowance,
onSwapTxBroadcast,
})
const translate = useTranslate()
const swapperName = useAppSelector(selectActiveSwapperName)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ type UseTradeButtonPropsProps = {
currentHopIndex: SupportedTradeQuoteStepIndex
activeTradeId: string
isExactAllowance: boolean
onSwapTxBroadcast?: () => void
}

type TradeButtonProps = {
Expand All @@ -45,6 +46,7 @@ export const useTradeButtonProps = ({
currentHopIndex,
activeTradeId,
isExactAllowance,
onSwapTxBroadcast,
}: UseTradeButtonPropsProps): TradeButtonProps | undefined => {
const dispatch = useAppDispatch()
const navigate = useNavigate()
Expand Down Expand Up @@ -143,7 +145,7 @@ export const useTradeButtonProps = ({
relayerTxHash,
])

const executeTrade = useTradeExecution(currentHopIndex, activeTradeId)
const executeTrade = useTradeExecution(currentHopIndex, activeTradeId, onSwapTxBroadcast)

const handleSignTx = useCallback(() => {
if (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ import { store, useAppDispatch, useAppSelector } from '@/state/store'
export const useTradeExecution = (
hopIndex: SupportedTradeQuoteStepIndex,
confirmedTradeId: TradeQuote['id'],
onSwapTxBroadcast?: () => void,
) => {
const translate = useTranslate()
const dispatch = useAppDispatch()
Expand Down Expand Up @@ -238,6 +239,8 @@ export const useTradeExecution = (
})
}

onSwapTxBroadcast?.()

// Don't navigate away during QuickBuy - let the QuickBuy component handle the success state
if (!isQuickBuy) {
navigate(TradeRoutePaths.Input)
Expand Down Expand Up @@ -772,6 +775,7 @@ export const useTradeExecution = (
swapsById,
toast,
isQuickBuy,
onSwapTxBroadcast,
])

return executeTrade
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,14 @@ type TradeInputProps = {
tradeInputRef: React.MutableRefObject<HTMLDivElement | null>
isCompact?: boolean
isStandalone?: boolean
isModal?: boolean
onChangeTab: (newTab: TradeInputTab) => void
}

export const TradeInput = ({
isCompact,
isStandalone,
isModal,
tradeInputRef,
onChangeTab,
}: TradeInputProps) => {
Expand Down Expand Up @@ -609,6 +611,7 @@ export const TradeInput = ({
onSubmit={handleTradeQuoteConfirm}
onChangeTab={onChangeTab}
isStandalone={isStandalone}
isModal={isModal}
/>
</>
)
Expand Down
13 changes: 13 additions & 0 deletions src/components/MultiHopTrade/const.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,16 @@ export const cardstyles: CardProps = {
boxShadow: '0 1px 0 rgba(255,255,255,0.05) inset, 0 2px 5px rgba(0,0,0,.2)',
},
}

export const modalCardStyles: CardProps = {
bg: 'transparent',
borderColor: 'transparent',
boxShadow: 'none',
borderWidth: 0,
borderRadius: 0,
_dark: {
bg: 'transparent',
borderColor: 'transparent',
boxShadow: 'none',
},
}
Loading