Skip to content

Commit

Permalink
chore: minor issue fix EX-1712 EX-1713 EX-1893
Browse files Browse the repository at this point in the history
  • Loading branch information
viet-nv committed Jul 25, 2024
1 parent 89aa13f commit 9fe50ac
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 145 deletions.
41 changes: 0 additions & 41 deletions src/components/SwapForm/SwapModal/SwapDetails/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { Flex, Text } from 'rebass'
import { BuildRouteData } from 'services/route/types/buildRoute'

import { TruncatedText } from 'components'
import { ButtonLight } from 'components/Button'
import { AutoColumn } from 'components/Column'
import CopyHelper from 'components/Copy'
import Divider from 'components/Divider'
Expand All @@ -18,9 +17,7 @@ import { TooltipTextOfSwapFee } from 'components/SwapForm/TradeSummary'
import useCheckStablePairSwap from 'components/SwapForm/hooks/useCheckStablePairSwap'
import { MouseoverTooltip, TextDashed } from 'components/Tooltip'
import { StyledBalanceMaxMini } from 'components/swapv2/styleds'
import { APP_PATHS } from 'constants/index'
import { useActiveWeb3React } from 'hooks'
import { isSupportKyberDao, useGasRefundTier } from 'hooks/kyberdao'
import useENS from 'hooks/useENS'
import useTheme from 'hooks/useTheme'
import { useCheckCorrelatedPair } from 'state/swap/hooks'
Expand Down Expand Up @@ -79,7 +76,6 @@ export default function SwapDetails({
const [showInverted, setShowInverted] = useState<boolean>(false)
const theme = useTheme()
const { slippage, routeSummary } = useSwapFormContext()
const { gasRefundPercentage } = useGasRefundTier()

const currencyIn = routeSummary?.parsedAmountIn?.currency
const currencyOut = routeSummary?.parsedAmountOut?.currency
Expand Down Expand Up @@ -111,8 +107,6 @@ export default function SwapDetails({
const feeAmountWithSymbol =
feeAmountFromBuild && currencyFromBuild?.symbol ? `${feeAmountFromBuild} ${currencyFromBuild.symbol}` : ''

const isPartnerSwap = window.location.pathname.includes(APP_PATHS.PARTNER_SWAP)

const feeAmount = routeSummary?.extraFee?.feeAmount

const [paymentToken] = usePaymentToken()
Expand Down Expand Up @@ -380,41 +374,6 @@ export default function SwapDetails({
</TYPE.black>
</RowBetween>

{!isPartnerSwap && isSupportKyberDao(chainId) && account && Number(routeSummary?.amountInUsd || 0) > 200 && (
<RowBetween height="20px" style={{ gap: '16px' }}>
<RowFixed>
<TextDashed fontSize={12} fontWeight={400} color={theme.subText}>
<MouseoverTooltip
text={
<Text>
<Trans>
Stake KNC in KyberDAO to get gas refund. Read more{' '}
<ExternalLink href="https://docs.kyberswap.com/governance/knc-token/gas-refund-program">
here ↗
</ExternalLink>
</Trans>
</Text>
}
placement="right"
>
<Trans>Gas Refund</Trans>
</MouseoverTooltip>
</TextDashed>
</RowFixed>

<ButtonLight
padding="0px 8px"
width="fit-content"
fontSize={10}
fontWeight={500}
lineHeight="16px"
style={{ pointerEvents: 'none' }}
>
<Trans>{gasRefundPercentage ? gasRefundPercentage * 100 : '--'}% Refund</Trans>
</ButtonLight>
</RowBetween>
)}

<Divider />
{recipient && (
<RowBetween>
Expand Down
44 changes: 2 additions & 42 deletions src/components/SwapForm/TradeSummary.tsx
Original file line number Diff line number Diff line change
@@ -1,20 +1,16 @@
import { Trans } from '@lingui/macro'
import React, { useEffect, useState } from 'react'
import { NavLink, useSearchParams } from 'react-router-dom'
import { useSearchParams } from 'react-router-dom'
import { Flex, Text } from 'rebass'
import styled from 'styled-components'

import { ReactComponent as RoutingIcon } from 'assets/svg/routing-icon.svg'
import { ButtonLight } from 'components/Button'
import { AutoColumn } from 'components/Column'
import { RowBetween, RowFixed } from 'components/Row'
import { useSwapFormContext } from 'components/SwapForm/SwapFormContext'
import { MouseoverTooltip, TextDashed } from 'components/Tooltip'
import TradePrice from 'components/swapv2/TradePrice'
import { APP_PATHS, BIPS_BASE } from 'constants/index'
import { useActiveWeb3React } from 'hooks'
import { isSupportKyberDao, useGasRefundTier } from 'hooks/kyberdao'
import useMixpanel, { MIXPANEL_TYPE } from 'hooks/useMixpanel'
import { BIPS_BASE } from 'constants/index'
import useTheme from 'hooks/useTheme'
import { ExternalLink, TYPE } from 'theme'
import { DetailedRouteSummary } from 'types/route'
Expand Down Expand Up @@ -148,9 +144,7 @@ type Props = {
refreshCallback: () => void
}
const TradeSummary: React.FC<Props> = ({ routeSummary, slippage, disableRefresh, refreshCallback }) => {
const { account, chainId } = useActiveWeb3React()
const theme = useTheme()
const { gasRefundPercentage } = useGasRefundTier()
const [alreadyVisible, setAlreadyVisible] = useState(false)
const { parsedAmountOut, priceImpact } = routeSummary || {}
const hasTrade = !!routeSummary?.route
Expand All @@ -175,15 +169,12 @@ const TradeSummary: React.FC<Props> = ({ routeSummary, slippage, disableRefresh,
''
)

const { mixpanelHandler } = useMixpanel()

useEffect(() => {
if (hasTrade) {
setAlreadyVisible(true)
}
}, [hasTrade])

const isPartnerSwap = window.location.pathname.includes(APP_PATHS.PARTNER_SWAP)
return (
<Wrapper $visible={alreadyVisible} $disabled={!hasTrade}>
<AutoColumn gap="0.75rem">
Expand Down Expand Up @@ -251,37 +242,6 @@ const TradeSummary: React.FC<Props> = ({ routeSummary, slippage, disableRefresh,
</TYPE.black>
</RowBetween>

{!isPartnerSwap && isSupportKyberDao(chainId) && (
<RowBetween>
<RowFixed>
<TextDashed fontSize={12} fontWeight={400} color={theme.subText}>
<MouseoverTooltip
text={
<Trans>
Stake KNC in KyberDAO to get gas refund. Read more{' '}
<ExternalLink href="https://docs.kyberswap.com/governance/knc-token/gas-refund-program">
here ↗
</ExternalLink>
</Trans>
}
placement="right"
>
<Trans>Gas Refund</Trans>
</MouseoverTooltip>
</TextDashed>
</RowFixed>
<NavLink
to={APP_PATHS.KYBERDAO_KNC_UTILITY}
onClick={() => {
mixpanelHandler(MIXPANEL_TYPE.GAS_REFUND_SOURCE_CLICK, { source: 'Swap_page_more_info' })
}}
>
<ButtonLight padding="0px 8px" width="fit-content" fontSize={10} fontWeight={500} lineHeight="16px">
<Trans>{account ? gasRefundPercentage * 100 : '--'}% Refund</Trans>
</ButtonLight>
</NavLink>
</RowBetween>
)}
<SwapFee />
</AutoColumn>
</Wrapper>
Expand Down
8 changes: 1 addition & 7 deletions src/pages/About/AboutKyberSwap/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -345,13 +345,7 @@ function AboutKyberSwap() {
<OptimismLogoFull />
<ZkSyncFull color={theme.text} />
<LineaFull />
<img
src={
'https://polygontechnology.notion.site/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2Fdd9f65de-0698-41f4-9a0e-4120b50b8176%2FPolygon_zkEVM_logo_light.svg?table=block&id=5d157d90-9ed4-48e4-be5d-4405bb02a2aa&spaceId=51562dc1-1dc5-4484-bf96-2aeac848ae2f&userId=&cache=v2'
}
alt="zkevm"
width="100%"
/>
<img src={'https://i.imgur.com/QP6x5aC.png'} alt="zkevm" width="100%" />
<img
src="https://raw.githubusercontent.com/base-org/brand-kit/001c0e9b40a67799ebe0418671ac4e02a0c683ce/logo/wordmark/Base_Wordmark_Blue.svg"
alt="Base"
Expand Down
31 changes: 3 additions & 28 deletions src/pages/MyPool/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { JSBI, Pair } from '@kyberswap/ks-sdk-classic'
import { Token, TokenAmount } from '@kyberswap/ks-sdk-core'
import { Trans, t } from '@lingui/macro'
import { BigNumber } from 'ethers'
import { rgba } from 'polished'
import { useMemo, useState } from 'react'
import { Info } from 'react-feather'
import { useSearchParams } from 'react-router-dom'
Expand All @@ -14,15 +13,14 @@ import { ButtonPrimary } from 'components/Button'
import Card from 'components/Card'
import ClassicElasticTab from 'components/ClassicElasticTab'
import { AutoColumn } from 'components/Column'
import Wallet from 'components/Icons/Wallet'
import Withdraw from 'components/Icons/Withdraw'
import LocalLoader from 'components/LocalLoader'
import FullPositionCard from 'components/PositionCard'
import { AutoRow } from 'components/Row'
import Search from 'components/Search'
import { SwitchLocaleLink } from 'components/SwitchLocaleLink'
import Tutorial, { TutorialType } from 'components/Tutorial'
import { APP_PATHS, DMM_ANALYTICS_URL } from 'constants/index'
import { APP_PATHS } from 'constants/index'
import { VERSION } from 'constants/v2'
import { usePairByAddress, usePairsByAddress } from 'data/Reserves'
import { useActiveWeb3React } from 'hooks'
Expand All @@ -39,7 +37,7 @@ import ClassicFarmUpdater from 'state/farms/classic/updater'
import { UserLiquidityPosition, useUserLiquidityPositions } from 'state/pools/hooks'
import { useLiquidityPositionTokenPairs, useToV2LiquidityTokens } from 'state/user/hooks'
import { useTokenBalancesWithLoadingIndicator } from 'state/wallet/hooks'
import { ExternalLink, StyledInternalLink, TYPE } from 'theme'
import { StyledInternalLink, TYPE } from 'theme'

export const Tab = styled.div<{ active: boolean }>`
padding: 4px 0;
Expand Down Expand Up @@ -188,7 +186,7 @@ export default function PoolCombination() {

function MyPoolClassic() {
const theme = useTheme()
const { account, chainId, networkInfo } = useActiveWeb3React()
const { account, networkInfo } = useActiveWeb3React()

const under768 = useMedia('(max-width:768px)')
const liquidityPositionTokenPairs = useLiquidityPositionTokenPairs()
Expand Down Expand Up @@ -321,16 +319,6 @@ function MyPoolClassic() {
<AutoRow>
<InstructionText>
<Trans>Here you can view all your liquidity and staked balances in the Classic Pools.</Trans>
{!upToSmall && (
<ExternalLink href={`${DMM_ANALYTICS_URL[chainId]}/account/${account}`}>
<Flex alignItems="center">
<Wallet size={16} />
<Text fontSize="14px" marginLeft="4px">
<Trans>Analyze Wallet</Trans>
</Text>
</Flex>
</ExternalLink>
)}
</InstructionText>
</AutoRow>
<TitleRow>
Expand Down Expand Up @@ -364,19 +352,6 @@ function MyPoolClassic() {

{upToSmall && (
<Flex sx={{ gap: '12px' }}>
<ExternalLink href={`${DMM_ANALYTICS_URL[chainId]}/account/${account}`}>
<Flex
sx={{ borderRadius: '50%' }}
width="36px"
backgroundColor={rgba(theme.subText, 0.2)}
height="36px"
alignItems="center"
justifyContent="center"
>
<Wallet size={16} color={theme.subText} />
</Flex>
</ExternalLink>

<Tutorial type={TutorialType.CLASSIC_MY_POOLS} />
</Flex>
)}
Expand Down
30 changes: 3 additions & 27 deletions src/pages/ProAmmPool/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { Trans, t } from '@lingui/macro'
import { BigNumber } from 'ethers'
import { rgba } from 'polished'
import { useCallback, useMemo, useRef, useState } from 'react'
import { isMobile } from 'react-device-detect'
import { Info } from 'react-feather'
Expand All @@ -11,12 +10,11 @@ import styled from 'styled-components'

import Card from 'components/Card'
import { AutoColumn } from 'components/Column'
import Wallet from 'components/Icons/Wallet'
import Search from 'components/Search'
import SubscribeNotificationButton from 'components/SubscribeButton'
import Toggle from 'components/Toggle'
import Tutorial, { TutorialType } from 'components/Tutorial'
import { APP_PATHS, PROMM_ANALYTICS_URL } from 'constants/index'
import { APP_PATHS } from 'constants/index'
import { VERSION } from 'constants/v2'
import { useActiveWeb3React } from 'hooks'
import useDebounce from 'hooks/useDebounce'
Expand All @@ -28,7 +26,7 @@ import { FilterRow, InstructionText, PageWrapper, PositionCardGrid, Tab } from '
import { FarmUpdater } from 'state/farms/elastic/hooks'
import { useElasticFarmsV2 } from 'state/farms/elasticv2/hooks'
import ElasticFarmV2Updater from 'state/farms/elasticv2/updater'
import { ExternalLink, StyledInternalLink, TYPE } from 'theme'
import { StyledInternalLink, TYPE } from 'theme'
import { PositionDetails } from 'types/position'

import ContentLoader from './ContentLoader'
Expand Down Expand Up @@ -83,7 +81,7 @@ const renderNotificationButton = (iconOnly: boolean) => {
}

export default function ProAmmPool() {
const { account, chainId, networkInfo } = useActiveWeb3React()
const { account, networkInfo } = useActiveWeb3React()
const tokenAddressSymbolMap = useRef<AddressSymbolMapInterface>({})
const { positions, loading: positionsLoading } = useProAmmPositions(account)

Expand Down Expand Up @@ -227,16 +225,6 @@ export default function ProAmmPool() {
<AutoColumn gap="lg" style={{ width: '100%' }}>
<InstructionText>
<Trans>Here you can view all your liquidity and staked balances in the Elastic Pools.</Trans>
{!upToSmall && (
<ExternalLink href={`${PROMM_ANALYTICS_URL[chainId]}/account/${account}`}>
<Flex alignItems="center">
<Wallet size={16} />
<Text fontSize="14px" marginLeft="4px">
<Trans>Analyze Wallet</Trans>
</Text>
</Flex>
</ExternalLink>
)}
</InstructionText>
<TabRow>
<Flex justifyContent="space-between" flex={1} alignItems="center" width="100%">
Expand Down Expand Up @@ -264,18 +252,6 @@ export default function ProAmmPool() {

{upToSmall && (
<Flex sx={{ gap: '8px' }}>
<ExternalLink href={`${PROMM_ANALYTICS_URL[chainId]}/account/${account}`}>
<Flex
sx={{ borderRadius: '50%' }}
width="36px"
backgroundColor={rgba(theme.subText, 0.2)}
height="36px"
alignItems="center"
justifyContent="center"
>
<Wallet size={16} color={theme.subText} />
</Flex>
</ExternalLink>
<Tutorial type={TutorialType.ELASTIC_MY_POOLS} />
{renderNotificationButton(true)}
</Flex>
Expand Down

0 comments on commit 9fe50ac

Please sign in to comment.