@@ -8,23 +8,19 @@ import Modal from 'components/Modal'
88import { HStack , Stack } from 'components/Stack'
99import TokenLogo from 'components/TokenLogo'
1010import useTheme from 'hooks/useTheme'
11- import { AddLiquidityReviewData } from 'pages/Earns/PoolDetail/AddLiquidity/hooks/useAddLiquidityReviewData'
12- import { EARN_DEXES , Exchange } from 'pages/Earns/constants'
11+ import { AddLiquidityReviewData } from 'pages/Earns/PoolDetail/AddLiquidity/hooks/useReviewData'
1312import { CloseIcon } from 'theme/components'
1413import { formatDisplayNumber } from 'utils/numbers'
1514
1615interface AddLiquidityReviewModalProps {
1716 isOpen ?: boolean
18- exchange ?: string
19- data ?: AddLiquidityReviewData | null
17+ review ?: AddLiquidityReviewData
2018 confirmText ?: string
2119 confirmDisabled ?: boolean
2220 confirmLoading ?: boolean
2321 txHash ?: string
2422 txStatus ?: 'success' | 'failed' | 'cancelled' | ''
2523 txError ?: string | null
26- slippage ?: number
27- suggestedSlippage ?: number
2824 transactionExplorerUrl ?: string
2925 onDismiss ?: ( ) => void
3026 onConfirm ?: ( ) => void
@@ -196,16 +192,13 @@ const formatBpsLabel = (value?: number) => {
196192
197193export default function AddLiquidityReviewModal ( {
198194 isOpen = false ,
199- exchange,
200- data,
195+ review,
201196 confirmText = 'Add Liquidity' ,
202197 confirmDisabled = false ,
203198 confirmLoading = false ,
204199 txHash,
205200 txStatus = '' ,
206201 txError,
207- slippage,
208- suggestedSlippage,
209202 transactionExplorerUrl,
210203 onDismiss,
211204 onConfirm,
@@ -214,12 +207,16 @@ export default function AddLiquidityReviewModal({
214207 onViewPosition,
215208} : AddLiquidityReviewModalProps ) {
216209 const theme = useTheme ( )
217- const protocol = exchange ? EARN_DEXES [ exchange as Exchange ] : undefined
218- const header = data ?. header
219- const zapInItems = data ?. zapInItems || [ ]
220- const estimate = data ?. estimate
221- const priceInfo = data ?. priceInfo
222- const warnings = data ?. warnings || [ ]
210+
211+ const header = review ?. header
212+ const estimate = review ?. estimate
213+ const priceInfo = review ?. priceInfo
214+ const warnings = review ?. warnings || [ ]
215+ const zapInItems = review ?. zapInItems || [ ]
216+
217+ const totalInputUsd = review ?. totalInputUsd || 0
218+ const slippage = estimate ?. slippage
219+ const suggestedSlippage = estimate ?. suggestedSlippage
223220
224221 if ( confirmLoading || txHash || txError || txStatus ) {
225222 const translatedErrorMessage = txError ? translateFriendlyErrorMessage ( txError ) : undefined
@@ -282,10 +279,10 @@ export default function AddLiquidityReviewModal({
282279 < Stack gap = { 4 } minWidth = { 0 } >
283280 < PairText color = { theme . text } > { header . pairLabel } </ PairText >
284281 < HStack align = "center" gap = { 8 } wrap = "wrap" >
285- { protocol ? (
282+ { header . protocolName ? (
286283 < HStack align = "center" gap = { 6 } >
287- { protocol . logo ? < ProtocolLogo alt = { protocol . name } src = { protocol . logo } /> : null }
288- < LabelText color = { theme . subText } > { protocol . name } </ LabelText >
284+ { header . protocolLogo ? < ProtocolLogo alt = { header . protocolName } src = { header . protocolLogo } /> : null }
285+ < LabelText color = { theme . subText } > { header . protocolName } </ LabelText >
289286 </ HStack >
290287 ) : null }
291288 { header . feeLabel ? (
@@ -302,7 +299,7 @@ export default function AddLiquidityReviewModal({
302299 < HStack align = "center" justify = "space-between" >
303300 < BodyText color = { theme . subText } > Zap-in Amount</ BodyText >
304301 < TotalText color = { theme . text } >
305- { formatDisplayNumber ( data ?. totalInputUsd || 0 , { style : 'currency' , significantDigits : 6 } ) }
302+ { formatDisplayNumber ( totalInputUsd , { style : 'currency' , significantDigits : 6 } ) }
306303 </ TotalText >
307304 </ HStack >
308305 < Stack gap = { 8 } >
0 commit comments