diff --git a/src/App.tsx b/src/App.tsx index 50e90ef8..0120c34f 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -90,10 +90,6 @@ const AppBody = () => { } }, [connector, dispatch, account]) - useEffect(() => { - dispatch(fetchETHPriceUSD()) - }, [dispatch]) - usePosthog() useSaveConnectedAddressToStore() useSentry() diff --git a/src/components/tBTC/BridgeActivity.tsx b/src/components/tBTC/BridgeActivity.tsx index 39399a17..7f641029 100644 --- a/src/components/tBTC/BridgeActivity.tsx +++ b/src/components/tBTC/BridgeActivity.tsx @@ -36,7 +36,9 @@ export type BridgeActivityProps = { type BridgeActivityContextValue = { [Property in keyof BridgeActivityProps]-?: BridgeActivityProps[Property] -} & { isBridgeHistoryEmpty: boolean } +} & { + isBridgeHistoryEmpty: boolean +} const BridgeActivityContext = createContext< BridgeActivityContextValue | undefined @@ -87,12 +89,15 @@ export const BridgeAcivityHeader: FC = (props) => { export const BridgeActivityData: FC = (props) => { const { data, isBridgeHistoryEmpty, isFetching, emptyState } = useBridgeActivityContext() + const { active } = useWeb3React() return isFetching ? ( ) : ( - {isBridgeHistoryEmpty ? emptyState : data.map(renderActivityItem)} + {active && !isBridgeHistoryEmpty + ? data.map(renderActivityItem) + : emptyState} ) } @@ -182,14 +187,18 @@ export const ActivityItemWrapper: FC = ({ children }) => ( export const BridgeActivityEmptyHistoryImg: FC = () => { const { isBridgeHistoryEmpty, isFetching } = useBridgeActivityContext() - const epmtyHistoryImg = useColorModeValue( + const { active } = useWeb3React() + const emptyHistoryImg = useColorModeValue( emptyHistoryImageSrcLight, emptyHistoryImageSrcDark ) - return isBridgeHistoryEmpty && !isFetching ? ( + const shouldRenderEmptyState = + !active || (isBridgeHistoryEmpty && !isFetching) + + return shouldRenderEmptyState ? ( <> - no-history + no-history You have no history yet. ) : ( diff --git a/src/contexts/TokenContext.tsx b/src/contexts/TokenContext.tsx index 9b32329b..b97c0b2b 100644 --- a/src/contexts/TokenContext.tsx +++ b/src/contexts/TokenContext.tsx @@ -1,7 +1,8 @@ -import React, { createContext } from "react" -import { Contract } from "@ethersproject/contracts" import { AddressZero } from "@ethersproject/constants" +import { Contract } from "@ethersproject/contracts" import { useWeb3React } from "@web3-react/core" +import React, { createContext } from "react" +import { featureFlags } from "../constants" import { useKeep } from "../web3/hooks/useKeep" import { useNu } from "../web3/hooks/useNu" import { useT } from "../web3/hooks/useT" @@ -11,7 +12,6 @@ import { Token } from "../enums" import { TokenState } from "../types" import { useTBTCTokenContract } from "../web3/hooks" import { useTBTCv2TokenContract } from "../web3/hooks/useTBTCv2TokenContract" -import { featureFlags } from "../constants" interface TokenContextState extends TokenState { contract: Contract | null