1- import type { FC } from 'react'
1+ import type { ReactElement } from 'react'
22import { formatUnits } from 'viem'
33import { formatWidgetAllowance , formatWidgetValue } from '../shared/valueDisplay'
44import type { WithdrawRouteType } from './types'
@@ -32,10 +32,16 @@ interface WithdrawDetailsProps {
3232 allowance ?: bigint
3333 allowanceTokenDecimals ?: number
3434 allowanceTokenSymbol ?: string
35+ approvalSpenderName ?: string
3536 onAllowanceClick ?: ( ) => void
37+ onShowApprovalOverlay ?: ( ) => void
3638}
3739
38- export const WithdrawDetails : FC < WithdrawDetailsProps > = ( {
40+ function getApprovalLabel ( approvalSpenderName ?: string ) : string {
41+ return approvalSpenderName ? `Existing Approval (${ approvalSpenderName } )` : 'Existing Approval'
42+ }
43+
44+ export function WithdrawDetails ( {
3945 actionLabel,
4046 requiredShares,
4147 sharesDecimals,
@@ -56,11 +62,12 @@ export const WithdrawDetails: FC<WithdrawDetailsProps> = ({
5662 allowance,
5763 allowanceTokenDecimals,
5864 allowanceTokenSymbol,
59- onAllowanceClick
60- } ) => {
65+ approvalSpenderName,
66+ onAllowanceClick,
67+ onShowApprovalOverlay
68+ } : WithdrawDetailsProps ) : ReactElement {
6169 const allowanceDisplay = formatWidgetAllowance ( allowance , allowanceTokenDecimals )
62-
63- // Calculate price impact (withdraw amount USD vs expected output USD)
70+ const approvalLabel = getApprovalLabel ( approvalSpenderName )
6471 const withdrawUsdValue = Number ( formatUnits ( withdrawAmountBn , assetDecimals ) ) * assetUsdPrice
6572 const expectedOutUsdValue = Number ( formatUnits ( expectedOut , outputDecimals ) ) * outputUsdPrice
6673 const priceImpact =
@@ -131,7 +138,17 @@ export const WithdrawDetails: FC<WithdrawDetailsProps> = ({
131138 { /* Approved allowance (for zap withdrawals) */ }
132139 { allowanceDisplay && (
133140 < div className = "flex items-center justify-between h-5" >
134- < p className = "text-sm text-text-secondary" > Existing Approval</ p >
141+ { onShowApprovalOverlay ? (
142+ < button
143+ type = "button"
144+ onClick = { onShowApprovalOverlay }
145+ className = "text-sm text-text-secondary hover:text-text-primary transition-colors yearn--link-dots"
146+ >
147+ { approvalLabel }
148+ </ button >
149+ ) : (
150+ < p className = "text-sm text-text-secondary" > { approvalLabel } </ p >
151+ ) }
135152 { onAllowanceClick && allowanceDisplay !== 'Unlimited' ? (
136153 < button
137154 type = "button"
0 commit comments