diff --git a/src/components/NavBar/SearchBar.tsx b/src/components/NavBar/SearchBar.tsx index eec877978b..2db8c274ac 100644 --- a/src/components/NavBar/SearchBar.tsx +++ b/src/components/NavBar/SearchBar.tsx @@ -8,6 +8,7 @@ import { TraceEvent } from 'analytics/TraceEvent' import clsx from 'clsx' import { NftVariant, useNftFlag } from 'featureFlags/flags/nft' import useDebounce from 'hooks/useDebounce' +import { useIsNftPage } from 'hooks/useIsNftPage' import { useOnClickOutside } from 'hooks/useOnClickOutside' import { organizeSearchResults } from 'lib/utils/searchBar' import { Box } from 'nft/components/Box' @@ -60,7 +61,7 @@ export const SearchBar = () => { } ) - const isNFTPage = pathname.includes('/nfts') + const isNFTPage = useIsNftPage() const [reducedTokens, reducedCollections] = organizeSearchResults(isNFTPage, tokens ?? [], collections ?? []) diff --git a/src/components/NavBar/SearchBarDropdown.tsx b/src/components/NavBar/SearchBarDropdown.tsx index 08d5162f4a..47fb9384ff 100644 --- a/src/components/NavBar/SearchBarDropdown.tsx +++ b/src/components/NavBar/SearchBarDropdown.tsx @@ -2,6 +2,7 @@ import { Trans } from '@lingui/macro' import { NavBarSearchTypes, SectionName } from 'analytics/constants' import { useTrace } from 'analytics/Trace' import { NftVariant, useNftFlag } from 'featureFlags/flags/nft' +import { useIsNftPage } from 'hooks/useIsNftPage' import { Box } from 'nft/components/Box' import { Column, Row } from 'nft/components/Flex' import { subheadSmall } from 'nft/css/common.css' @@ -113,7 +114,7 @@ export const SearchBarDropdown = ({ const { history: searchHistory, updateItem: updateSearchHistory } = useSearchHistory() const shortenedHistory = useMemo(() => searchHistory.slice(0, 2), [searchHistory]) const { pathname } = useLocation() - const isNFTPage = pathname.includes('/nfts') + const isNFTPage = useIsNftPage() const isTokenPage = pathname.includes('/tokens') const phase1Flag = useNftFlag() const [resultsState, setResultsState] = useState() diff --git a/src/components/Polling/index.tsx b/src/components/Polling/index.tsx index 30041d8912..426b2448f5 100644 --- a/src/components/Polling/index.tsx +++ b/src/components/Polling/index.tsx @@ -4,6 +4,7 @@ import { RowFixed } from 'components/Row' import { getChainInfo } from 'constants/chainInfo' import useCurrentBlockTimestamp from 'hooks/useCurrentBlockTimestamp' import useGasPrice from 'hooks/useGasPrice' +import { useIsNftPage } from 'hooks/useIsNftPage' import useMachineTimeMs from 'hooks/useMachineTime' import JSBI from 'jsbi' import useBlockNumber from 'lib/hooks/useBlockNumber' @@ -106,6 +107,7 @@ export default function Polling() { const machineTime = useMachineTimeMs(NETWORK_HEALTH_CHECK_MS) const blockTime = useCurrentBlockTimestamp() const theme = useTheme() + const isNftPage = useIsNftPage() const ethGasPrice = useGasPrice() const priceGwei = ethGasPrice ? JSBI.divide(ethGasPrice, JSBI.BigInt(1000000000)) : undefined @@ -135,7 +137,7 @@ export default function Polling() { //TODO - chainlink gas oracle is really slow. Can we get a better data source? - return ( + return isNftPage ? null : ( <> setIsHover(true)} onMouseLeave={() => setIsHover(false)} warning={warning}>