From 2c680af6db52249573a37a7480076423e57f7c03 Mon Sep 17 00:00:00 2001 From: iamacook Date: Tue, 19 Sep 2023 18:38:23 +0200 Subject: [PATCH 1/2] fix: close transaction modal if already on `href` --- src/components/tx-flow/common/TxButton.tsx | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/components/tx-flow/common/TxButton.tsx b/src/components/tx-flow/common/TxButton.tsx index 032437807c..0c193e99a3 100644 --- a/src/components/tx-flow/common/TxButton.tsx +++ b/src/components/tx-flow/common/TxButton.tsx @@ -6,6 +6,8 @@ import { useTxBuilderApp } from '@/hooks/safe-apps/useTxBuilderApp' import { AppRoutes } from '@/config/routes' import Track from '@/components/common/Track' import { MODALS_EVENTS } from '@/services/analytics' +import { useContext } from 'react' +import { TxModalContext } from '..' const buttonSx = { height: '58px', @@ -24,11 +26,15 @@ export const SendTokensButton = ({ onClick, sx }: { onClick: () => void; sx?: Bu export const SendNFTsButton = () => { const router = useRouter() + const { setTxFlow } = useContext(TxModalContext) + + const isNftPage = router.pathname === AppRoutes.balances.nfts + const onClick = isNftPage ? () => setTxFlow(undefined) : undefined return ( - @@ -38,12 +44,18 @@ export const SendNFTsButton = () => { export const TxBuilderButton = () => { const txBuilder = useTxBuilderApp() + const router = useRouter() + const { setTxFlow } = useContext(TxModalContext) + if (!txBuilder?.app) return null + const isTxBuilder = router.pathname === AppRoutes.balances.nfts + const onClick = isTxBuilder ? () => setTxFlow(undefined) : undefined + return ( - From f92aa433744a805e6d2bbf4bcbdad9f27ca4b9b1 Mon Sep 17 00:00:00 2001 From: iamacook Date: Tue, 19 Sep 2023 18:46:26 +0200 Subject: [PATCH 2/2] fix: Transaction Builder link --- src/components/tx-flow/common/TxButton.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/tx-flow/common/TxButton.tsx b/src/components/tx-flow/common/TxButton.tsx index 0c193e99a3..c0f03ac000 100644 --- a/src/components/tx-flow/common/TxButton.tsx +++ b/src/components/tx-flow/common/TxButton.tsx @@ -49,7 +49,7 @@ export const TxBuilderButton = () => { if (!txBuilder?.app) return null - const isTxBuilder = router.pathname === AppRoutes.balances.nfts + const isTxBuilder = typeof txBuilder.link.query === 'object' && router.query.appUrl === txBuilder.link.query?.appUrl const onClick = isTxBuilder ? () => setTxFlow(undefined) : undefined return (