fix: Token Warning dismiss/redirect (#4482)
* Remove cancel option from TokenSafety modal * Only redirect if token is blocked * Remove unused variables Co-authored-by: gbugyis <greg@bugyis.com>
This commit is contained in:
parent
f824fb25c2
commit
29baaaf2ed
@ -10,7 +10,7 @@ import { ExternalLink as LinkIconFeather } from 'react-feather'
|
||||
import { Text } from 'rebass'
|
||||
import { useAddUserToken } from 'state/user/hooks'
|
||||
import styled from 'styled-components/macro'
|
||||
import { ButtonText, CopyLinkIcon, ExternalLink } from 'theme'
|
||||
import { CopyLinkIcon, ExternalLink } from 'theme'
|
||||
import { ExplorerDataType, getExplorerLink } from 'utils/getExplorerLink'
|
||||
|
||||
const Wrapper = styled.div`
|
||||
@ -62,13 +62,6 @@ const StyledCloseButton = styled(StyledButton)`
|
||||
}
|
||||
`
|
||||
|
||||
const StyledCancelButton = styled(ButtonText)`
|
||||
margin-top: 16px;
|
||||
color: ${({ theme }) => theme.textSecondary};
|
||||
font-weight: 600;
|
||||
font-size: 14px;
|
||||
`
|
||||
|
||||
const Buttons = ({
|
||||
warning,
|
||||
onContinue,
|
||||
@ -83,7 +76,6 @@ const Buttons = ({
|
||||
<StyledButton onClick={onContinue}>
|
||||
<Trans>I understand</Trans>
|
||||
</StyledButton>
|
||||
<StyledCancelButton onClick={onCancel}>Cancel</StyledCancelButton>
|
||||
</>
|
||||
) : (
|
||||
<StyledCloseButton onClick={onCancel}>
|
||||
|
@ -5,7 +5,7 @@ import PriceChart from 'components/Tokens/TokenDetails/PriceChart'
|
||||
import { VerifiedIcon } from 'components/TokenSafety/TokenSafetyIcon'
|
||||
import TokenSafetyModal from 'components/TokenSafety/TokenSafetyModal'
|
||||
import { getChainInfo } from 'constants/chainInfo'
|
||||
import { checkWarning } from 'constants/tokenSafety'
|
||||
import { checkWarning, WARNING_LEVEL } from 'constants/tokenSafety'
|
||||
import { chainIdToChainName, useTokenDetailQuery } from 'graphql/data/TokenDetailQuery'
|
||||
import { useCurrency, useIsUserAddedToken, useToken } from 'hooks/Tokens'
|
||||
import { useAtomValue } from 'jotai/utils'
|
||||
@ -188,6 +188,10 @@ export default function LoadedTokenDetail({ address }: { address: string }) {
|
||||
const handleDismissWarning = useCallback(() => {
|
||||
setWarningModalOpen(false)
|
||||
}, [setWarningModalOpen])
|
||||
const handleCancel = useCallback(() => {
|
||||
setWarningModalOpen(false)
|
||||
warning && warning.level === WARNING_LEVEL.BLOCKED && navigate(-1)
|
||||
}, [setWarningModalOpen, navigate, warning])
|
||||
const chainInfo = getChainInfo(token?.chainId)
|
||||
const networkLabel = chainInfo?.label
|
||||
const networkBadgebackgroundColor = chainInfo?.backgroundColor
|
||||
@ -280,7 +284,7 @@ export default function LoadedTokenDetail({ address }: { address: string }) {
|
||||
<TokenSafetyModal
|
||||
isOpen={warningModalOpen}
|
||||
tokenAddress={address}
|
||||
onCancel={() => navigate(-1)}
|
||||
onCancel={handleCancel}
|
||||
onContinue={handleDismissWarning}
|
||||
/>
|
||||
</TopArea>
|
||||
|
Loading…
Reference in New Issue
Block a user