Skip to content

Commit

Permalink
fix: hide YouSaved and YouCouldHaveSaved components (#8586)
Browse files Browse the repository at this point in the history
  • Loading branch information
woodenfurniture authored Jan 15, 2025
1 parent c732da2 commit ee2731e
Showing 1 changed file with 1 addition and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,13 @@ import {
CardBody,
CardFooter,
Collapse,
Divider,
Flex,
HStack,
Icon,
Stack,
useDisclosure,
} from '@chakra-ui/react'
import type { Asset } from '@shapeshiftoss/types'
import { bnOrZero } from '@shapeshiftoss/utils'
import type { InterpolationOptions } from 'node-polyglot'
import { useCallback } from 'react'
import { useTranslate } from 'react-polyglot'
Expand All @@ -22,16 +20,10 @@ import { AnimatedCheck } from 'components/AnimatedCheck'
import { AssetIcon } from 'components/AssetIcon'
import { SlideTransition } from 'components/SlideTransition'
import { Text } from 'components/Text'
import {
selectLastHop,
selectTradeQuoteAffiliateFeeAfterDiscountUserCurrency,
selectTradeQuoteAffiliateFeeDiscountUserCurrency,
} from 'state/slices/tradeQuoteSlice/selectors'
import { selectLastHop } from 'state/slices/tradeQuoteSlice/selectors'
import { useAppSelector } from 'state/store'

import { TwirlyToggle } from '../TwirlyToggle'
import { YouCouldHaveSaved } from './components/YouCouldHaveSaved'
import { YouSaved } from './components/YouSaved'

export type TradeSuccessProps = {
handleBack: () => void
Expand Down Expand Up @@ -60,15 +52,6 @@ export const TradeSuccess = ({

const lastHop = useAppSelector(selectLastHop)

const feeSavingUserCurrency = useAppSelector(selectTradeQuoteAffiliateFeeDiscountUserCurrency)

const affiliateFeeUserCurrency = useAppSelector(
selectTradeQuoteAffiliateFeeAfterDiscountUserCurrency,
)

const hasFeeSaving = !bnOrZero(feeSavingUserCurrency).isZero()
const couldHaveReducedFee = !hasFeeSaving && !bnOrZero(affiliateFeeUserCurrency).isZero()

const AmountsLine = useCallback(() => {
if (!(sellAsset && buyAsset)) return null
if (!(sellAmountCryptoPrecision && buyAmountCryptoPrecision)) return null
Expand Down Expand Up @@ -114,13 +97,8 @@ export const TradeSuccess = ({
<Button mt={4} size='lg' width='full' onClick={handleBack} colorScheme='blue'>
{translate('trade.doAnotherTrade')}
</Button>
{hasFeeSaving && <YouSaved feeSavingUserCurrency={feeSavingUserCurrency!} />}
{couldHaveReducedFee && (
<YouCouldHaveSaved affiliateFeeUserCurrency={affiliateFeeUserCurrency!} />
)}
</Stack>
</CardBody>
<Divider />
<CardFooter flexDir='column' gap={2} px={8}>
<SlideTransition>
<HStack width='full' justifyContent='space-between' mt={4}>
Expand Down

0 comments on commit ee2731e

Please sign in to comment.