From ea742c87d916e5719c02213b04743965534170f4 Mon Sep 17 00:00:00 2001 From: fairlighteth <31534717+fairlighteth@users.noreply.github.com> Date: Wed, 16 Oct 2024 11:37:34 +0100 Subject: [PATCH] feat: do not show banners without connect wallet --- .../src/modules/application/containers/App/index.tsx | 5 ++++- .../src/modules/tokensList/pure/TokensVirtualList/index.tsx | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/apps/cowswap-frontend/src/modules/application/containers/App/index.tsx b/apps/cowswap-frontend/src/modules/application/containers/App/index.tsx index 8cdbbbbc57..83a1a3810a 100644 --- a/apps/cowswap-frontend/src/modules/application/containers/App/index.tsx +++ b/apps/cowswap-frontend/src/modules/application/containers/App/index.tsx @@ -3,6 +3,7 @@ import { lazy, PropsWithChildren, Suspense, useMemo } from 'react' import { useMediaQuery } from '@cowprotocol/common-hooks' import { isInjectedWidget } from '@cowprotocol/common-utils' import { Color, Footer, GlobalCoWDAOStyles, Media, MenuBar } from '@cowprotocol/ui' +import { useWalletInfo } from '@cowprotocol/wallet' import { NavLink } from 'react-router-dom' import { ThemeProvider } from 'theme' @@ -94,6 +95,8 @@ export function App() { ) + const { account } = useWalletInfo() + return ( }> @@ -129,7 +132,7 @@ export function App() { )} {/* CoW AMM banner */} - {!isInjectedWidgetMode && } + {!isInjectedWidgetMode && account && } diff --git a/apps/cowswap-frontend/src/modules/tokensList/pure/TokensVirtualList/index.tsx b/apps/cowswap-frontend/src/modules/tokensList/pure/TokensVirtualList/index.tsx index 33377421db..c1313c0e5d 100644 --- a/apps/cowswap-frontend/src/modules/tokensList/pure/TokensVirtualList/index.tsx +++ b/apps/cowswap-frontend/src/modules/tokensList/pure/TokensVirtualList/index.tsx @@ -1,6 +1,7 @@ import { useCallback, useMemo, useRef } from 'react' import { TokenWithLogo } from '@cowprotocol/common-const' +import { useWalletInfo } from '@cowprotocol/wallet' import { useVirtualizer } from '@tanstack/react-virtual' import ms from 'ms.macro' @@ -35,6 +36,8 @@ export function TokensVirtualList(props: TokensVirtualListProps) { props const { values: balances, isLoading: balancesLoading } = balancesState + const { account: connectedAccount } = useWalletInfo() + const isWalletConnected = !!account const scrollTimeoutRef = useRef() @@ -67,7 +70,7 @@ export function TokensVirtualList(props: TokensVirtualListProps) { return ( - + {connectedAccount && } {items.map((virtualRow) => {