@@ -15,6 +15,7 @@ import { TransactionsList } from './components/TransactionList/TransactionsList'
1515import { ChangeNetworksButton } from './components/Wallet/ChangeNetworksButton'
1616import { WalletButton } from './components/Wallet/WalletButton'
1717import ProtocolActivityToggle from 'components/ProtocolActivity/ProtocolActivityToggle'
18+ import { useRouter } from 'next/router'
1819
1920export function SiteNavigation ( ) {
2021 const [ hasMounted , setHasMounted ] = useState ( false )
@@ -33,6 +34,12 @@ export function SiteNavigation() {
3334
3435const DesktopSiteNavigation = ( ) => {
3536 const { chainUnsupported } = useWallet ( )
37+ const router = useRouter ( )
38+
39+ // Hide protocol activity toggle on project pages
40+ const isProjectPage = router . pathname . startsWith ( '/v5/' ) || router . pathname . startsWith ( '/v4/' )
41+ const isProjectRoute = / ^ \/ ( v 4 | v 5 ) \/ [ ^ \/ ] + / . test ( router . asPath )
42+ const showProtocolActivityToggle = ! ( isProjectPage && isProjectRoute )
3643
3744 return (
3845 < div className = "z-20 w-full min-w-0 px-6 xl:px-20" >
@@ -74,7 +81,7 @@ const DesktopSiteNavigation = () => {
7481 < NavLanguageSelector className = "md:order-2" />
7582 < ThemePicker className = "md:order-3" />
7683 < QuickProjectSearchButton className = "md:order-1" />
77- < ProtocolActivityToggle className = "hidden md:flex md:order-4" />
84+ { showProtocolActivityToggle && < ProtocolActivityToggle className = "hidden md:flex md:order-4" /> }
7885 < TransactionsList listClassName = "absolute top-full mt-4 right-0 md:-right-6 md:w-[320px] w-full" />
7986 </ div >
8087 </ div >
@@ -93,6 +100,12 @@ const DesktopSiteNavigation = () => {
93100
94101const MobileSiteNavigation = ( ) => {
95102 const { chainUnsupported } = useWallet ( )
103+ const router = useRouter ( )
104+
105+ // Hide protocol activity toggle on project pages
106+ const isProjectPage = router . pathname . startsWith ( '/v5/' ) || router . pathname . startsWith ( '/v4/' )
107+ const isProjectRoute = / ^ \/ ( v 4 | v 5 ) \/ [ ^ \/ ] + / . test ( router . asPath )
108+ const showProtocolActivityToggle = ! ( isProjectPage && isProjectRoute )
96109
97110 return (
98111 < div className = "fixed z-20 w-full min-w-0 md:static md:px-6 xl:px-20" >
@@ -157,7 +170,7 @@ const MobileSiteNavigation = () => {
157170 < NavLanguageSelector className = "md:order-2" />
158171 < ThemePicker className = "md:order-3" />
159172 < QuickProjectSearchButton className = "md:order-1" />
160- < ProtocolActivityToggle className = "hidden md:flex md:order-4" />
173+ { showProtocolActivityToggle && < ProtocolActivityToggle className = "hidden md:flex md:order-4" /> }
161174 < TransactionsList listClassName = "absolute top-full mt-4 right-0 md:-right-6 md:w-[320px] w-full" />
162175 </ div >
163176 </ div >
0 commit comments