remove offline exchange dialog from testnet3 prod (#40)
This commit is contained in:
parent
cf68740725
commit
342bd2d334
@ -1,15 +1,13 @@
|
||||
import { useCallback, useEffect } from 'react';
|
||||
import { useCallback } from 'react';
|
||||
import { useDispatch, useSelector } from 'react-redux';
|
||||
|
||||
import { DialogTypes } from '@/constants/dialogs';
|
||||
import { LocalStorageKey } from '@/constants/localStorage';
|
||||
import { CLIENT_NETWORK_CONFIGS, DEFAULT_APP_ENVIRONMENT, DydxNetwork } from '@/constants/networks';
|
||||
import { DEFAULT_APP_ENVIRONMENT, DydxNetwork } from '@/constants/networks';
|
||||
|
||||
import { useAccounts, useLocalStorage } from '@/hooks';
|
||||
|
||||
import { setSelectedNetwork } from '@/state/app';
|
||||
import { getSelectedNetwork } from '@/state/appSelectors';
|
||||
import { openDialog } from '@/state/dialogs';
|
||||
|
||||
export const useSelectedNetwork = (): {
|
||||
switchNetwork: (network: DydxNetwork) => void;
|
||||
@ -24,17 +22,6 @@ export const useSelectedNetwork = (): {
|
||||
defaultValue: DEFAULT_APP_ENVIRONMENT,
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
if (
|
||||
import.meta.env.MODE === 'production' &&
|
||||
CLIENT_NETWORK_CONFIGS[selectedNetwork].dydxChainId === 'dydx-testnet-3'
|
||||
) {
|
||||
dispatch(
|
||||
openDialog({ type: DialogTypes.ExchangeOffline, dialogProps: { preventClose: true } })
|
||||
);
|
||||
}
|
||||
}, [selectedNetwork]);
|
||||
|
||||
const switchNetwork = useCallback(
|
||||
(network: DydxNetwork) => {
|
||||
disconnect();
|
||||
|
||||
@ -5,8 +5,6 @@ import { shallowEqual, useDispatch, useSelector } from 'react-redux';
|
||||
import { AbacusApiStatus } from '@/constants/abacus';
|
||||
import { DialogTypes } from '@/constants/dialogs';
|
||||
import { STRING_KEYS } from '@/constants/localization';
|
||||
import { CLIENT_NETWORK_CONFIGS } from '@/constants/networks';
|
||||
import { UNICODE } from '@/constants/unicode';
|
||||
import { useApiState, useStringGetter } from '@/hooks';
|
||||
import { layoutMixins } from '@/styles/layoutMixins';
|
||||
|
||||
@ -31,16 +29,8 @@ export const ExchangeOfflineDialog = ({ preventClose, setIsOpen }: ElementProps)
|
||||
const selectedNetwork = useSelector(getSelectedNetwork);
|
||||
const activeDialog = useSelector(getActiveDialog, shallowEqual);
|
||||
|
||||
const showOfflineMessage =
|
||||
import.meta.env.MODE === 'production' &&
|
||||
CLIENT_NETWORK_CONFIGS[selectedNetwork].dydxChainId === 'dydx-testnet-3';
|
||||
|
||||
useEffect(() => {
|
||||
if (
|
||||
activeDialog?.type === DialogTypes.ExchangeOffline &&
|
||||
status === AbacusApiStatus.NORMAL &&
|
||||
!showOfflineMessage
|
||||
) {
|
||||
if (activeDialog?.type === DialogTypes.ExchangeOffline && status === AbacusApiStatus.NORMAL) {
|
||||
dispatch(closeDialog());
|
||||
}
|
||||
}, [status, selectedNetwork]);
|
||||
@ -53,16 +43,7 @@ export const ExchangeOfflineDialog = ({ preventClose, setIsOpen }: ElementProps)
|
||||
title={stringGetter({ key: STRING_KEYS.UNAVAILABLE })}
|
||||
>
|
||||
<Styled.Content>
|
||||
{showOfflineMessage ? (
|
||||
<>
|
||||
<p>Testnet is currently offline. Please check back!</p>
|
||||
<Styled.Link href="https://v4-teacher.vercel.app/testnets/schedule">
|
||||
{stringGetter({ key: STRING_KEYS.LEARN_MORE })} {UNICODE.ARROW_RIGHT}
|
||||
</Styled.Link>
|
||||
</>
|
||||
) : (
|
||||
<p>{statusErrorMessage}</p>
|
||||
)}
|
||||
<p>{statusErrorMessage}</p>
|
||||
{import.meta.env.MODE !== 'production' && <NetworkSelectMenu />}
|
||||
</Styled.Content>
|
||||
</Dialog>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user