diff --git a/e2e/screenshots/strategy/disposable/Disposable_buy_limit/create/my-strategy.png b/e2e/screenshots/strategy/disposable/Disposable_buy_limit/create/my-strategy.png index f21dc9c1b..d40d85c1c 100644 Binary files a/e2e/screenshots/strategy/disposable/Disposable_buy_limit/create/my-strategy.png and b/e2e/screenshots/strategy/disposable/Disposable_buy_limit/create/my-strategy.png differ diff --git a/e2e/screenshots/strategy/disposable/Disposable_buy_range/create/my-strategy.png b/e2e/screenshots/strategy/disposable/Disposable_buy_range/create/my-strategy.png index 3904da283..c5a92c55b 100644 Binary files a/e2e/screenshots/strategy/disposable/Disposable_buy_range/create/my-strategy.png and b/e2e/screenshots/strategy/disposable/Disposable_buy_range/create/my-strategy.png differ diff --git a/e2e/screenshots/strategy/disposable/Disposable_buy_range/deposit/form.png b/e2e/screenshots/strategy/disposable/Disposable_buy_range/deposit/form.png index dae52990f..e8db6bd3a 100644 Binary files a/e2e/screenshots/strategy/disposable/Disposable_buy_range/deposit/form.png and b/e2e/screenshots/strategy/disposable/Disposable_buy_range/deposit/form.png differ diff --git a/e2e/screenshots/strategy/disposable/Disposable_sell_limit/create/my-strategy.png b/e2e/screenshots/strategy/disposable/Disposable_sell_limit/create/my-strategy.png index f176cd954..dfcea93b4 100644 Binary files a/e2e/screenshots/strategy/disposable/Disposable_sell_limit/create/my-strategy.png and b/e2e/screenshots/strategy/disposable/Disposable_sell_limit/create/my-strategy.png differ diff --git a/e2e/screenshots/strategy/disposable/Disposable_sell_range/create/my-strategy.png b/e2e/screenshots/strategy/disposable/Disposable_sell_range/create/my-strategy.png index 412b4a662..511ee2159 100644 Binary files a/e2e/screenshots/strategy/disposable/Disposable_sell_range/create/my-strategy.png and b/e2e/screenshots/strategy/disposable/Disposable_sell_range/create/my-strategy.png differ diff --git a/e2e/screenshots/strategy/overlapping/Overlapping/create/my-strategy.png b/e2e/screenshots/strategy/overlapping/Overlapping/create/my-strategy.png index 0a427d8b4..820efc21c 100644 Binary files a/e2e/screenshots/strategy/overlapping/Overlapping/create/my-strategy.png and b/e2e/screenshots/strategy/overlapping/Overlapping/create/my-strategy.png differ diff --git a/e2e/screenshots/strategy/overlapping/Overlapping/editPrices/form.png b/e2e/screenshots/strategy/overlapping/Overlapping/editPrices/form.png index 7e895866e..74b298ea8 100644 Binary files a/e2e/screenshots/strategy/overlapping/Overlapping/editPrices/form.png and b/e2e/screenshots/strategy/overlapping/Overlapping/editPrices/form.png differ diff --git a/e2e/screenshots/strategy/recurring/Recurring_limit_limit/create/form.png b/e2e/screenshots/strategy/recurring/Recurring_limit_limit/create/form.png index 68ef8c144..84f0d9a22 100644 Binary files a/e2e/screenshots/strategy/recurring/Recurring_limit_limit/create/form.png and b/e2e/screenshots/strategy/recurring/Recurring_limit_limit/create/form.png differ diff --git a/e2e/screenshots/strategy/recurring/Recurring_limit_limit/create/my-strategy.png b/e2e/screenshots/strategy/recurring/Recurring_limit_limit/create/my-strategy.png index e54e86657..37e2904f7 100644 Binary files a/e2e/screenshots/strategy/recurring/Recurring_limit_limit/create/my-strategy.png and b/e2e/screenshots/strategy/recurring/Recurring_limit_limit/create/my-strategy.png differ diff --git a/e2e/screenshots/strategy/recurring/Recurring_limit_range/create/my-strategy.png b/e2e/screenshots/strategy/recurring/Recurring_limit_range/create/my-strategy.png index 0ab6f5da7..477ba45d4 100644 Binary files a/e2e/screenshots/strategy/recurring/Recurring_limit_range/create/my-strategy.png and b/e2e/screenshots/strategy/recurring/Recurring_limit_range/create/my-strategy.png differ diff --git a/e2e/screenshots/strategy/recurring/Recurring_range_limit/create/my-strategy.png b/e2e/screenshots/strategy/recurring/Recurring_range_limit/create/my-strategy.png index 6207aff40..04922cc38 100644 Binary files a/e2e/screenshots/strategy/recurring/Recurring_range_limit/create/my-strategy.png and b/e2e/screenshots/strategy/recurring/Recurring_range_limit/create/my-strategy.png differ diff --git a/e2e/screenshots/strategy/recurring/Recurring_range_range/create/my-strategy.png b/e2e/screenshots/strategy/recurring/Recurring_range_range/create/my-strategy.png index 5a5aafbd4..2c3c277f7 100644 Binary files a/e2e/screenshots/strategy/recurring/Recurring_range_range/create/my-strategy.png and b/e2e/screenshots/strategy/recurring/Recurring_range_range/create/my-strategy.png differ diff --git a/src/components/core/menu/mainMenu/MainMenuRight.tsx b/src/components/core/menu/mainMenu/MainMenuRight.tsx index 9d6198717..8a355d706 100644 --- a/src/components/core/menu/mainMenu/MainMenuRight.tsx +++ b/src/components/core/menu/mainMenu/MainMenuRight.tsx @@ -1,22 +1,42 @@ -import { FC } from 'react'; -import { IS_TENDERLY_FORK } from 'libs/wagmi'; +import { FC, useEffect, useState } from 'react'; import { useBreakpoints } from 'hooks/useBreakpoints'; import { MainMenuRightWallet } from 'components/core/menu/mainMenu/MainMenuRightWallet'; import { MainMenuRightNotifications } from 'components/core/menu/mainMenu/MainMenuRightNotifications'; -import { Button } from 'components/common/button'; import { MainMenuRightBurger } from './MainMenuRightBurger'; import { useBurgerMenuItems } from './MainMenuRightBurger/useBurgerMenuItems'; import { MainMenuRightChainSelector } from './MainMenuRightChainSelector'; import { networks } from 'config'; import { MainMenuCart } from './MainMenuCart'; +import { lsService } from 'services/localeStorage'; +import { Link } from '@tanstack/react-router'; import config from 'config'; const TenderlyForkAlert = () => { - return IS_TENDERLY_FORK ? ( - - ) : null; + const [isDebugMode, setIsDebugMode] = useState(false); + useEffect(() => { + const checkDebugMode = () => { + if (!!lsService.getItem('imposterAccount')) return setIsDebugMode(true); + if (!!lsService.getItem('tenderlyRpc')) return setIsDebugMode(true); + if (!!lsService.getItem('configOverride')) return setIsDebugMode(true); + const api = lsService.getItem('carbonApi'); + if (api && api !== config.carbonApi) return setIsDebugMode(true); + setIsDebugMode(false); + }; + checkDebugMode(); + window.addEventListener('storage', checkDebugMode); + return () => window.removeEventListener('storage', checkDebugMode); + }, []); + + if (!isDebugMode) return; + + return ( + + Debug Mode + + ); }; export const MainMenuRight: FC = () => { diff --git a/src/components/debug/DebugConfig.tsx b/src/components/debug/DebugConfig.tsx index 21cec4f5e..29ed8c904 100644 --- a/src/components/debug/DebugConfig.tsx +++ b/src/components/debug/DebugConfig.tsx @@ -21,14 +21,14 @@ export const DebugConfig = () => { try { if (!configOverride) { setConfigOverride(''); + localStorage.clear(); lsService.removeItem('configOverride'); + window?.location.reload(); } else { const parsedConfig = JSON.parse(configOverride || ''); const result = v.safeParse(v.partial(AppConfigSchema), parsedConfig); if (result.success) { - for (let i = 0; i < localStorage.length; i++) { - localStorage.removeItem(localStorage.key(i)!); - } + localStorage.clear(); lsService.setItem('configOverride', parsedConfig); window?.location.reload(); } else { diff --git a/src/utils/managedLocalStorage.ts b/src/utils/managedLocalStorage.ts index 5562ddafd..1a9d86872 100644 --- a/src/utils/managedLocalStorage.ts +++ b/src/utils/managedLocalStorage.ts @@ -13,6 +13,19 @@ export class ManagedLocalStorage { } } + private emit(formattedId: string, newValue: string | null) { + // Reproduce "storage" event so it run also within the context of the same document + const event = new StorageEvent('storage', { + key: formattedId, + newValue: newValue, + // If this become needed in the app we can send oldValue too, but it requires an additional getItem() call + oldValue: null, + // eslint-disable-next-line no-restricted-globals + url: location.href, + }); + window.dispatchEvent(event); + } + getItem = (key: K): T[K] | undefined => { const formattedId = this.keyFormatter(key); const value = localStorage.getItem(formattedId); @@ -48,21 +61,13 @@ export class ManagedLocalStorage { localStorage.setItem(formattedId, stringValue); - // Reproduce "storage" event so it run also within the context of the same document - const event = new StorageEvent('storage', { - key: formattedId, - newValue: stringValue, - // If this become needed in the app we can send oldValue too, but it requires an additional getItem() call - oldValue: null, - // eslint-disable-next-line no-restricted-globals - url: location.href, - }); - window.dispatchEvent(event); + this.emit(formattedId, stringValue); }; removeItem = (key: K) => { const formattedId = this.keyFormatter(key); localStorage.removeItem(formattedId); + this.emit(formattedId, null); }; migrateItems = () => {