From a69f757c12cd24dc8182831f6e5929f12f5ad285 Mon Sep 17 00:00:00 2001 From: Christophe Roberge Date: Wed, 2 Dec 2026 10:30:44 -0500 Subject: [PATCH] fix: Temporarily disable test mode --- src/layouts/MobileMenu.tsx | 4 +-- src/layouts/SettingsMenu.tsx | 3 -- .../components/TestNetModeSwitcher.tsx | 36 ------------------- src/utils/marketsAndNetworksConfig.ts | 4 +-- 4 files changed, 3 insertions(+), 44 deletions(-) delete mode 100644 src/layouts/components/TestNetModeSwitcher.tsx diff --git a/src/layouts/MobileMenu.tsx b/src/layouts/MobileMenu.tsx index ad7c7af499..3d46c86f59 100644 --- a/src/layouts/MobileMenu.tsx +++ b/src/layouts/MobileMenu.tsx @@ -9,13 +9,12 @@ import { useConnectGate } from 'src/hooks/useConnectGate'; import { useModalContext } from 'src/hooks/useModal'; import { useRootStore } from 'src/store/root'; import { figVars } from 'src/utils/figmaColors'; -import { isFeatureEnabled, PROD_ENV } from 'src/utils/marketsAndNetworksConfig'; +import { isFeatureEnabled } from 'src/utils/marketsAndNetworksConfig'; import { DrawerWrapper } from './components/DrawerWrapper'; import { LanguageListItem, LanguagesList } from './components/LanguageSwitcher'; import { NavItems } from './components/NavItems'; import { ShieldSwitcher } from './components/ShieldSwitcher'; -import { TestNetModeSwitcher } from './components/TestNetModeSwitcher'; import { ThemeListItem, ThemesList } from './components/ThemeSwitcher'; // The drill-in lists the options view can be replaced by. Keys are the submenu state. @@ -173,7 +172,6 @@ export const MobileMenu = ({ open, setOpen }: MobileMenuProps) => { - {PROD_ENV && } setSubmenu('languages')} /> setSubmenu('themes')} /> diff --git a/src/layouts/SettingsMenu.tsx b/src/layouts/SettingsMenu.tsx index 0f89286dac..54a6d6997f 100644 --- a/src/layouts/SettingsMenu.tsx +++ b/src/layouts/SettingsMenu.tsx @@ -6,11 +6,9 @@ import { useModalContext } from 'src/hooks/useModal'; import { DEFAULT_LOCALE } from 'src/libs/LanguageProvider'; import { useRootStore } from 'src/store/root'; import { SETTINGS } from 'src/utils/events'; -import { PROD_ENV } from 'src/utils/marketsAndNetworksConfig'; import { LanguageListItem, LanguagesList } from './components/LanguageSwitcher'; import { ShieldSwitcher } from './components/ShieldSwitcher'; -import { TestNetModeSwitcher } from './components/TestNetModeSwitcher'; import { ThemeListItem, ThemesList } from './components/ThemeSwitcher'; export const LANG_MAP = { @@ -79,7 +77,6 @@ export function SettingsMenu() { - {PROD_ENV && } setView('themes')} component={MenuItem} /> diff --git a/src/layouts/components/TestNetModeSwitcher.tsx b/src/layouts/components/TestNetModeSwitcher.tsx deleted file mode 100644 index 5a72201a3f..0000000000 --- a/src/layouts/components/TestNetModeSwitcher.tsx +++ /dev/null @@ -1,36 +0,0 @@ -import { Trans } from '@lingui/macro'; -import { ListItem, MenuItem } from '@mui/material'; -import { useState } from 'react'; -import { useRootStore } from 'src/store/root'; -import { SETTINGS } from 'src/utils/events'; - -import { SettingSwitchRow } from './SettingSwitchRow'; - -interface TestNetModeSwitcherProps { - component?: typeof MenuItem | typeof ListItem; -} - -export const TestNetModeSwitcher = ({ component = ListItem }: TestNetModeSwitcherProps) => { - const testnetsEnabledId = 'testnetsEnabled'; - const testnetsEnabledLocalstorage = localStorage.getItem(testnetsEnabledId) === 'true' || false; - const [testnetsEnabled, setTestnetsMode] = useState(testnetsEnabledLocalstorage); - const trackEvent = useRootStore((store) => store.trackEvent); - - const toggleTestnetsEnabled = () => { - const newState = !testnetsEnabled; - setTestnetsMode(!testnetsEnabled); - localStorage.setItem(testnetsEnabledId, newState ? 'true' : 'false'); - // Set window.location to trigger a page reload when navigating to the the dashboard - window.location.href = '/'; - }; - - return ( - Test Mode} - checked={testnetsEnabled} - onClick={toggleTestnetsEnabled} - onSwitchClick={() => trackEvent(SETTINGS.TESTNET_MODE)} - /> - ); -}; diff --git a/src/utils/marketsAndNetworksConfig.ts b/src/utils/marketsAndNetworksConfig.ts index 37a977ca2f..53850e80c0 100644 --- a/src/utils/marketsAndNetworksConfig.ts +++ b/src/utils/marketsAndNetworksConfig.ts @@ -23,8 +23,8 @@ export type Pool = { export const STAGING_ENV = process.env.NEXT_PUBLIC_ENV === 'staging'; export const PROD_ENV = !process.env.NEXT_PUBLIC_ENV || process.env.NEXT_PUBLIC_ENV === 'prod'; -export const ENABLE_TESTNET = - PROD_ENV && global?.window?.localStorage.getItem('testnetsEnabled') === 'true'; +// Test mode has been removed from the UI; testnets are always disabled. +export const ENABLE_TESTNET = false; // determines if forks should be shown export const FORK_ENABLED =