From f40a576a54e87f099edee6b15dcb5c62f0fd1dec Mon Sep 17 00:00:00 2001 From: dave Date: Mon, 28 Mar 2022 11:05:51 +0100 Subject: [PATCH] 1.12.0 - Revert Fee Breakdown Tooltip (#2596) * revert tooltip * green fee when discounted --- .../components/swap/FeeInformationTooltip.tsx | 59 ++++--------------- 1 file changed, 12 insertions(+), 47 deletions(-) diff --git a/src/custom/components/swap/FeeInformationTooltip.tsx b/src/custom/components/swap/FeeInformationTooltip.tsx index 894704a4f..acc44ba1c 100644 --- a/src/custom/components/swap/FeeInformationTooltip.tsx +++ b/src/custom/components/swap/FeeInformationTooltip.tsx @@ -1,5 +1,5 @@ -import React, { useCallback, useMemo } from 'react' -import { Currency, CurrencyAmount, Fraction, Percent, Token } from '@uniswap/sdk-core' +import React, { useMemo } from 'react' +import { Currency, CurrencyAmount, Token } from '@uniswap/sdk-core' import TradeGp from 'state/swap/TradeGp' import QuestionHelper from 'components/QuestionHelper' import styled from 'styled-components/macro' @@ -32,7 +32,7 @@ export const FeeInformationTooltipWrapper = styled.div` height: 60px; ` -const FeeTooltipLine = styled.p<{ discount?: boolean }>` +const FeeTooltipLine = styled.p` display: flex; flex-flow: row nowrap; justify-content: space-between; @@ -40,8 +40,6 @@ const FeeTooltipLine = styled.p<{ discount?: boolean }>` margin: 0; gap: 0 8px; - ${({ discount = false }) => discount && 'text-decoration: line-through;'} - font-size: small; > .green { @@ -82,56 +80,23 @@ type FeeBreakdownProps = FeeInformationTooltipProps & { symbol: string | undefined discount: number } -const ONE = new Fraction(1, 1) const FeeBreakdownLine = ({ feeAmount, discount, type, symbol }: FeeBreakdownProps) => { const typeString = type === 'From' ? '+' : '-' - const FeeAmount = useCallback(() => { - const discountAsPercent = new Percent(discount, 100) - // we need the fee BEFORE the discount as the backend will return us the adjusted fee with discount - const adjustedFee = feeAmount - ? formatSmart(feeAmount.multiply(ONE.add(discountAsPercent)), AMOUNT_PRECISION) - : undefined - - return ( - <> - Fee - {adjustedFee ? ( - - {typeString} - {adjustedFee} {symbol} - - ) : ( - Free - )} - - ) - }, [discount, feeAmount, symbol, typeString]) - - const FeeDiscountedAmount = useCallback(() => { - const smartFee = formatSmart(feeAmount, AMOUNT_PRECISION) - return ( - <> - Fee [-{discount}%] + const smartFee = formatSmart(feeAmount, AMOUNT_PRECISION) + + return ( + + Fee{smartFee && discount ? ` [-${discount}%]` : ''} + {smartFee ? ( {typeString} {smartFee} {symbol} - - ) - }, [discount, feeAmount, symbol, typeString]) - - return ( - <> - - - - {!!feeAmount && !!discount && ( - - - + ) : ( + Free )} - + ) }