Commit bc2f6856 authored by lynn's avatar lynn Committed by GitHub

fix: Web 1992 token details update blocked token detail pages (#5948)

* init

* Update src/components/Tokens/TokenDetails/index.tsx
Co-authored-by: default avatareddie <66155195+just-toby@users.noreply.github.com>

* oops last commit leads to error :/

---------
Co-authored-by: default avatareddie <66155195+just-toby@users.noreply.github.com>
parent f232643d
...@@ -153,6 +153,8 @@ export default function TokenDetails({ ...@@ -153,6 +153,8 @@ export default function TokenDetails({
const [continueSwap, setContinueSwap] = useState<{ resolve: (value: boolean | PromiseLike<boolean>) => void }>() const [continueSwap, setContinueSwap] = useState<{ resolve: (value: boolean | PromiseLike<boolean>) => void }>()
const [openTokenSafetyModal, setOpenTokenSafetyModal] = useState(false)
// Show token safety modal if Swap-reviewing a warning token, at all times if the current token is blocked // Show token safety modal if Swap-reviewing a warning token, at all times if the current token is blocked
const shouldShowSpeedbump = !useIsUserAddedTokenOnChain(address, pageChainId) && tokenWarning !== null const shouldShowSpeedbump = !useIsUserAddedTokenOnChain(address, pageChainId) && tokenWarning !== null
const onReviewSwapClick = useCallback( const onReviewSwapClick = useCallback(
...@@ -216,23 +218,27 @@ export default function TokenDetails({ ...@@ -216,23 +218,27 @@ export default function TokenDetails({
<TokenDetailsSkeleton /> <TokenDetailsSkeleton />
)} )}
<RightPanel> <RightPanel onClick={() => isBlockedToken && setOpenTokenSafetyModal(true)}>
<div style={{ pointerEvents: isBlockedToken ? 'none' : 'auto' }}>
<Widget <Widget
token={token ?? undefined} token={token ?? undefined}
defaultField={Field.OUTPUT} defaultField={Field.OUTPUT}
onTokenChange={navigateToWidgetSelectedToken} onTokenChange={navigateToWidgetSelectedToken}
onReviewSwapClick={onReviewSwapClick} onReviewSwapClick={onReviewSwapClick}
/> />
</div>
{tokenWarning && <TokenSafetyMessage tokenAddress={address} warning={tokenWarning} />} {tokenWarning && <TokenSafetyMessage tokenAddress={address} warning={tokenWarning} />}
{token && <BalanceSummary token={token} />} {token && <BalanceSummary token={token} />}
</RightPanel> </RightPanel>
{token && <MobileBalanceSummaryFooter token={token} />} {token && <MobileBalanceSummaryFooter token={token} />}
<TokenSafetyModal <TokenSafetyModal
isOpen={isBlockedToken || !!continueSwap} isOpen={openTokenSafetyModal || !!continueSwap}
tokenAddress={address} tokenAddress={address}
onContinue={() => onResolveSwap(true)} onContinue={() => onResolveSwap(true)}
onBlocked={() => navigate(-1)} onBlocked={() => {
setOpenTokenSafetyModal(false)
}}
onCancel={() => onResolveSwap(false)} onCancel={() => onResolveSwap(false)}
showCancel={true} showCancel={true}
/> />
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment