From 58bb68b7563f51a8ba2d7f38d92e4cab5ae5c383 Mon Sep 17 00:00:00 2001 From: brightiron Date: Thu, 21 Dec 2023 19:31:34 -0600 Subject: [PATCH 1/4] hide protocol metrics if no env variable set --- src/App.tsx | 5 ++++- src/components/Sidebar/NavContent.tsx | 4 +++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/App.tsx b/src/App.tsx index a1ff35bee4..0694cbd14e 100755 --- a/src/App.tsx +++ b/src/App.tsx @@ -21,6 +21,7 @@ import StagingNotification from "src/components/StagingNotification"; import { StakeVersionContainer } from "src/components/StakeVersionContainer"; import TopBar from "src/components/TopBar/TopBar"; import { shouldTriggerSafetyCheck } from "src/helpers"; +import { Environment } from "src/helpers/environment/Environment/Environment"; import { useGoogleAnalytics } from "src/hooks/useGoogleAnalytics"; import useTheme from "src/hooks/useTheme"; import { chains } from "src/hooks/wagmi"; @@ -202,6 +203,8 @@ function App() { if (isSidebarExpanded) handleSidebarClose(); }, [location]); + const protocolMetricsEnabled = Boolean(Environment.getWundergraphNodeUrl()); + const defaultRoute = protocolMetricsEnabled ? "/dashboard" : "/my-balances"; return ( }> } /> - } /> + } /> } diff --git a/src/components/Sidebar/NavContent.tsx b/src/components/Sidebar/NavContent.tsx index 902461b1aa..c995084cec 100644 --- a/src/components/Sidebar/NavContent.tsx +++ b/src/components/Sidebar/NavContent.tsx @@ -7,6 +7,7 @@ import { ReactComponent as lendAndBorrowIcon } from "src/assets/icons/lendAndBor import { ReactComponent as OlympusIcon } from "src/assets/icons/olympus-nav-header.svg"; import NavItem from "src/components/library/NavItem"; import { DecimalBigNumber } from "src/helpers/DecimalBigNumber/DecimalBigNumber"; +import { Environment } from "src/helpers/environment/Environment/Environment"; import { useTestableNetworks } from "src/hooks/useTestableNetworks"; import { BondDiscount } from "src/views/Bond/components/BondDiscount"; import { DetermineRangeDiscount } from "src/views/Range/hooks"; @@ -29,6 +30,7 @@ const NavContent: React.VFC = () => { const { chain = { id: 1 } } = useNetwork(); const networks = useTestableNetworks(); + const protocolMetricsEnabled = Boolean(Environment.getWundergraphNodeUrl()); return ( @@ -50,7 +52,7 @@ const NavContent: React.VFC = () => {