Skip to content

Commit

Permalink
fix: fon’t show swaps promo on unsupported chains
Browse files Browse the repository at this point in the history
  • Loading branch information
compojoom committed Jun 4, 2024
1 parent c4d40f3 commit 0f45fc1
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/features/swap/components/SwapWidget/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,22 @@ import { useRouter } from 'next/router'
import useLocalStorage from '@/services/local-storage/useLocalStorage'
import { SWAP_EVENTS, SWAP_LABELS } from '@/services/analytics/events/swaps'
import Track from '@/components/common/Track'
import { useHasFeature } from '@/hooks/useChains'
import { FEATURES } from '@/utils/chains'

const SWAP_PROMO_WIDGET_IS_HIDDEN = 'SWAP_PROMO_WIDGET_IS_HIDDEN'

function SwapWidget(): ReactElement | null {
const [isHidden = false, setIsHidden] = useLocalStorage<boolean>(SWAP_PROMO_WIDGET_IS_HIDDEN)
const isSwapFeatureEnabled = useHasFeature(FEATURES.NATIVE_SWAPS)

const onClick = useCallback(() => {
setIsHidden(true)
}, [setIsHidden])

const router = useRouter()

if (isHidden) {
if (isHidden || !isSwapFeatureEnabled) {
return null
}

Expand Down

0 comments on commit 0f45fc1

Please sign in to comment.