Skip to content

Commit

Permalink
fix: hide thorswap free fee banner after 2024 (#8435)
Browse files Browse the repository at this point in the history
  • Loading branch information
NeOMakinG authored Dec 20, 2024
1 parent 38db4d0 commit bab6906
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import type { CardProps } from '@chakra-ui/react'
import { Box, Card, Center, Flex, useMediaQuery } from '@chakra-ui/react'
import type { FormEvent } from 'react'
import { useMemo } from 'react'
import type { TradeInputTab } from 'components/MultiHopTrade/types'
import { ThorFreeFeeBanner } from 'components/ThorFreeFeeBanner/ThorFreeFeeBanner'
import { THORSWAP_MAXIMUM_YEAR_TRESHOLD } from 'lib/fees/model'
import { breakpoints } from 'theme/theme'

import { SharedTradeInputHeader } from '../SharedTradeInput/SharedTradeInputHeader'
Expand Down Expand Up @@ -46,6 +48,11 @@ export const SharedTradeInput: React.FC<SharedTradeInputProps> = ({
const [isSmallerThanXl] = useMediaQuery(`(max-width: ${breakpoints.xl})`, { ssr: false })
const totalHeight = useSharedHeight(tradeInputRef)

const shouldDisplayThorFreeFeeBanner = useMemo(
() => new Date().getUTCFullYear() < THORSWAP_MAXIMUM_YEAR_TRESHOLD,
[],
)

return (
<Flex
id='test-flex'
Expand All @@ -55,7 +62,7 @@ export const SharedTradeInput: React.FC<SharedTradeInputProps> = ({
>
<Center width='inherit' alignItems='flex-end'>
<Box width='full' maxWidth='500px'>
<ThorFreeFeeBanner />
{shouldDisplayThorFreeFeeBanner ? <ThorFreeFeeBanner /> : null}
<Card
flex={1}
width='full'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { useHistory } from 'react-router'
import { TradeSlideTransition } from 'components/MultiHopTrade/TradeSlideTransition'
import type { TradeRoutePaths } from 'components/MultiHopTrade/types'
import { ThorFreeFeeBanner } from 'components/ThorFreeFeeBanner/ThorFreeFeeBanner'
import { THORSWAP_MAXIMUM_YEAR_TRESHOLD } from 'lib/fees/model'
import { breakpoints } from 'theme/theme'

import type { LimitOrderRoutePaths } from './LimitOrder/types'
Expand Down Expand Up @@ -46,10 +47,15 @@ export const SlideTransitionRoute = ({
[width, height],
)

const shouldDisplayThorFreeFeeBanner = useMemo(
() => new Date().getUTCFullYear() < THORSWAP_MAXIMUM_YEAR_TRESHOLD,
[],
)

return (
<Center width='inherit' alignItems='flex-end'>
<Box width='full' maxWidth='500px'>
<ThorFreeFeeBanner />
{shouldDisplayThorFreeFeeBanner ? <ThorFreeFeeBanner /> : null}
<TradeSlideTransition>
<Flex
width='full'
Expand Down

0 comments on commit bab6906

Please sign in to comment.