Skip to content

Commit

Permalink
fix(widget): use custom label and content for partner fee (#4646) (#4651
Browse files Browse the repository at this point in the history
)

(cherry picked from commit fc81bb0)
  • Loading branch information
shoom3301 authored Jul 2, 2024
1 parent c4335f2 commit 2d71424
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export function TradeRateDetails({ rateInfoParams }: TradeRateDetailsProps) {
partnerFeeUsd={partnerFeeUsd}
partnerFeeAmount={partnerFeeAmount}
partnerFeeBps={partnerFeeBps}
feeTooltipMarkdown={widgetParams.content?.feeTooltipMarkdown}
widgetContent={widgetParams.content}
/>
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export function TradeFeesAndCosts(props: TradeFeesAndCostsProps) {
partnerFeeUsd={partnerFeeUsd}
partnerFeeAmount={partnerFeeAmount}
partnerFeeBps={partnerFeeBps}
feeTooltipMarkdown={widgetParams.content?.feeTooltipMarkdown}
widgetContent={widgetParams.content}
/>

{/*Network cost*/}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { bpsToPercent, formatPercent } from '@cowprotocol/common-utils'
import { CowSwapWidgetContent } from '@cowprotocol/widget-lib'
import { Currency, CurrencyAmount } from '@uniswap/sdk-core'

import ReactMarkdown from 'react-markdown'
import { Nullish } from 'types'

import * as styledEl from '../../containers/TradeBasicConfirmDetails/styled'
Expand All @@ -12,7 +14,7 @@ interface PartnerFeeRowProps {
partnerFeeBps: number | undefined
withTimelineDot: boolean
alwaysRow?: boolean
feeTooltipMarkdown?: string
widgetContent?: CowSwapWidgetContent
}

export function PartnerFeeRow({
Expand All @@ -21,7 +23,7 @@ export function PartnerFeeRow({
partnerFeeBps,
withTimelineDot,
alwaysRow,
feeTooltipMarkdown,
widgetContent,
}: PartnerFeeRowProps) {
const feeAsPercent = partnerFeeBps ? formatPercent(bpsToPercent(partnerFeeBps)) : null
const minPartnerFeeAmount = partnerFeeAmount?.equalTo(0)
Expand All @@ -37,7 +39,9 @@ export function PartnerFeeRow({
fiatAmount={partnerFeeUsd}
alwaysRow={alwaysRow}
tooltip={
feeTooltipMarkdown || (
widgetContent?.feeTooltipMarkdown ? (
<ReactMarkdown>{widgetContent.feeTooltipMarkdown}</ReactMarkdown>
) : (
<>
This fee helps pay for maintenance & improvements to the trade experience.
<br />
Expand All @@ -46,7 +50,7 @@ export function PartnerFeeRow({
</>
)
}
label={`Total fee (${feeAsPercent}%)`}
label={`${widgetContent?.feeLabel || 'Total fee'} (${feeAsPercent}%)`}
/>
) : (
<ReviewOrderModalAmountRow
Expand Down

0 comments on commit 2d71424

Please sign in to comment.