From d0f326907b4790250d38686ef0140052a86f6dc4 Mon Sep 17 00:00:00 2001 From: gary <1032230992@qq.com> Date: Thu, 12 May 2022 18:43:21 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BF=AE=E6=94=B9=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E5=A4=9A=E8=AF=AD=E8=A8=80=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/App.tsx | 92 ++++++++++++++++++++--------------------- src/ConfigProviders.tsx | 14 +++++++ src/Providers.tsx | 4 +- 3 files changed, 60 insertions(+), 50 deletions(-) create mode 100644 src/ConfigProviders.tsx diff --git a/src/App.tsx b/src/App.tsx index 95fbbef..43bf629 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -1,6 +1,6 @@ import React, { lazy, useEffect } from 'react' import { Router, Redirect, Route, Switch } from 'react-router-dom' -import { ResetCSS, ConfigProvider } from '@pancakeswap/uikit' +import { ResetCSS } from '@pancakeswap/uikit' import { useDispatch } from 'react-redux' import BigNumber from 'bignumber.js' import useEagerConnect from 'hooks/useEagerConnect' @@ -10,7 +10,6 @@ import { initAxios } from 'utils/request' import useToast from 'hooks/useToast' import { useAccountEventListener } from 'hooks/useAccountEventListener' import { fetchUserInfo, clearUserInfo } from 'state/actions' -import { useTranslation } from 'contexts/Localization' import { useAccount } from 'state/userInfo/hooks' import GlobalStyle from './style/Global' import Menu from './components/Menu' @@ -71,7 +70,6 @@ const App: React.FC = () => { const dispatch = useDispatch() const toast = useToast() const account = useAccount() - const { t } = useTranslation() useEffect(() => { initAxios(() => { @@ -83,38 +81,37 @@ const App: React.FC = () => { }, [account]) return ( - - - - - - }> - - - - - - - - - - - - - - - - - - - - - - - - - - {/* + + + + + }> + + + + + + + + + + + + + + + + + + + + + + + + + + {/* @@ -149,7 +146,7 @@ const App: React.FC = () => { {/* Using this format because these components use routes injected props. We need to rework them with hooks */} - {/* + {/* @@ -166,8 +163,8 @@ const App: React.FC = () => { */} - {/* Redirect */} - {/* + {/* Redirect */} + {/* @@ -177,16 +174,15 @@ const App: React.FC = () => { */} - {/* 404 */} - - - - - - - - - + {/* 404 */} + + + + + + + + ) } diff --git a/src/ConfigProviders.tsx b/src/ConfigProviders.tsx new file mode 100644 index 0000000..ae8b908 --- /dev/null +++ b/src/ConfigProviders.tsx @@ -0,0 +1,14 @@ +import React from 'react' +import { ConfigProvider, ModalProvider } from '@pancakeswap/uikit' +import { useTranslation } from 'contexts/Localization' + +const ConfigProviders: React.FC = ({ children }) => { + const { t } = useTranslation() + return ( + + {children} + + ) +} + +export default ConfigProviders diff --git a/src/Providers.tsx b/src/Providers.tsx index 332df94..cfa4a14 100644 --- a/src/Providers.tsx +++ b/src/Providers.tsx @@ -1,5 +1,4 @@ import React from 'react' -import { ModalProvider } from '@pancakeswap/uikit' import { Web3ReactProvider } from '@web3-react/core' import { HelmetProvider } from 'react-helmet-async' import { Provider } from 'react-redux' @@ -9,6 +8,7 @@ import { LanguageProvider } from 'contexts/Localization' import { RefreshContextProvider } from 'contexts/RefreshContext' import { ToastsProvider } from 'contexts/ToastsContext' import store from 'state' +import ConfigProviders from './ConfigProviders' const Providers: React.FC = ({ children }) => { return ( @@ -19,7 +19,7 @@ const Providers: React.FC = ({ children }) => { - {children} + {children}