From efb38439569940c51953acb9599c0989eb3308b4 Mon Sep 17 00:00:00 2001 From: Pete Watters <2938440+pete-watters@users.noreply.github.com> Date: Fri, 13 Oct 2023 13:05:20 +0100 Subject: [PATCH] fix: clean code, add note re ordinals modal --- .../features/settings-dropdown/settings-dropdown.tsx | 1 - src/app/pages/fund/fund.tsx | 4 +--- src/app/pages/receive/receive-modal.tsx | 10 +++------- src/app/pages/receive/receive-ordinal.tsx | 4 ++-- .../routes/hooks/use-background-location-redirect.ts | 7 +++++-- src/app/routes/receive-routes.tsx | 5 ----- 6 files changed, 11 insertions(+), 20 deletions(-) diff --git a/src/app/features/settings-dropdown/settings-dropdown.tsx b/src/app/features/settings-dropdown/settings-dropdown.tsx index 2d27eab08cf..1188917ce20 100644 --- a/src/app/features/settings-dropdown/settings-dropdown.tsx +++ b/src/app/features/settings-dropdown/settings-dropdown.tsx @@ -78,7 +78,6 @@ export function SettingsDropdown() { )} - {/* // more importantly I broke tests again for direct access to receive I think */} { diff --git a/src/app/pages/fund/fund.tsx b/src/app/pages/fund/fund.tsx index 4075b89eb67..066cd80ca6e 100644 --- a/src/app/pages/fund/fund.tsx +++ b/src/app/pages/fund/fund.tsx @@ -27,9 +27,7 @@ export function FundPage({ children }: FundPageProps) { return ( <> - <> - {children} - + {children} ); } diff --git a/src/app/pages/receive/receive-modal.tsx b/src/app/pages/receive/receive-modal.tsx index 0431877986f..8067883ac16 100644 --- a/src/app/pages/receive/receive-modal.tsx +++ b/src/app/pages/receive/receive-modal.tsx @@ -81,8 +81,7 @@ export function ReceiveModal({ type = 'full' }: ReceiveModalProps) { onCopyAddress={() => copyToClipboard(onCopyBtc)} onClickQrCode={() => navigate(`${RouteUrls.Home}${RouteUrls.ReceiveBtc}`, { - // see if i need ...location.state - state: { backgroundLocation, ...location.state }, + state: { backgroundLocation }, }) } title="Bitcoin" @@ -125,7 +124,7 @@ export function ReceiveModal({ type = 'full' }: ReceiveModalProps) { icon={} onClickQrCode={() => navigate(`${RouteUrls.Home}${RouteUrls.ReceiveBtcStamp}`, { - state: { backgroundLocation, ...location.state }, + state: { backgroundLocation }, }) } onCopyAddress={() => @@ -139,7 +138,7 @@ export function ReceiveModal({ type = 'full' }: ReceiveModalProps) { onCopyAddress={() => copyToClipboard(onCopyStx, 'select_nft_to_add_new_collectible')} onClickQrCode={() => navigate(`${RouteUrls.Home}${RouteUrls.ReceiveStx}`, { - state: { backgroundLocation, ...location.state }, + state: { backgroundLocation }, }) } title="Stacks NFT" @@ -147,9 +146,6 @@ export function ReceiveModal({ type = 'full' }: ReceiveModalProps) { - - {/* Outlet here for nested token routes */} - ); } diff --git a/src/app/pages/receive/receive-ordinal.tsx b/src/app/pages/receive/receive-ordinal.tsx index 4b236f1ba06..d485aa2bf94 100644 --- a/src/app/pages/receive/receive-ordinal.tsx +++ b/src/app/pages/receive/receive-ordinal.tsx @@ -13,14 +13,14 @@ export function ReceiveOrdinalModal() { useBackgroundLocationRedirect(); const analytics = useAnalytics(); const { state } = useLocation(); - const { onCopy } = useClipboard(state?.btcAddressTaproot); + const { onCopy } = useClipboard(state.btcAddressTaproot); function copyToClipboard() { void analytics.track('copy_address_to_add_new_inscription'); toast.success('Copied to clipboard!'); onCopy(); } - + // #4028 FIXME - this doesn't open in new tab as it loses btcAddressTaproot amd crashes btcStamp and Stx are OK? return ( } /> } /> } /> - {/* Needed to show receive ordinal in Receive flow */} - - } /> - - {/* Needed to show receive ordinal in Add flow */} } /> } />