Merge branch 'dev' into myf-dev
This commit is contained in:
commit
0dfa132f16
92
src/App.tsx
92
src/App.tsx
|
|
@ -1,6 +1,6 @@
|
||||||
import React, { lazy, useEffect } from 'react'
|
import React, { lazy, useEffect } from 'react'
|
||||||
import { Router, Redirect, Route, Switch } from 'react-router-dom'
|
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 { useDispatch } from 'react-redux'
|
||||||
import BigNumber from 'bignumber.js'
|
import BigNumber from 'bignumber.js'
|
||||||
import useEagerConnect from 'hooks/useEagerConnect'
|
import useEagerConnect from 'hooks/useEagerConnect'
|
||||||
|
|
@ -10,7 +10,6 @@ import { initAxios } from 'utils/request'
|
||||||
import useToast from 'hooks/useToast'
|
import useToast from 'hooks/useToast'
|
||||||
import { useAccountEventListener } from 'hooks/useAccountEventListener'
|
import { useAccountEventListener } from 'hooks/useAccountEventListener'
|
||||||
import { fetchUserInfo, clearUserInfo } from 'state/actions'
|
import { fetchUserInfo, clearUserInfo } from 'state/actions'
|
||||||
import { useTranslation } from 'contexts/Localization'
|
|
||||||
import { useAccount } from 'state/userInfo/hooks'
|
import { useAccount } from 'state/userInfo/hooks'
|
||||||
import GlobalStyle from './style/Global'
|
import GlobalStyle from './style/Global'
|
||||||
import Menu from './components/Menu'
|
import Menu from './components/Menu'
|
||||||
|
|
@ -71,7 +70,6 @@ const App: React.FC = () => {
|
||||||
const dispatch = useDispatch()
|
const dispatch = useDispatch()
|
||||||
const toast = useToast()
|
const toast = useToast()
|
||||||
const account = useAccount()
|
const account = useAccount()
|
||||||
const { t } = useTranslation()
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
initAxios(() => {
|
initAxios(() => {
|
||||||
|
|
@ -83,38 +81,37 @@ const App: React.FC = () => {
|
||||||
}, [account])
|
}, [account])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ConfigProvider t={t}>
|
<Router history={history}>
|
||||||
<Router history={history}>
|
<ResetCSS />
|
||||||
<ResetCSS />
|
<GlobalStyle />
|
||||||
<GlobalStyle />
|
<Menu>
|
||||||
<Menu>
|
<SuspenseWithChunkError fallback={<PageLoader />}>
|
||||||
<SuspenseWithChunkError fallback={<PageLoader />}>
|
<Switch>
|
||||||
<Switch>
|
<Route path="/" exact>
|
||||||
<Route path="/" exact>
|
<Home />
|
||||||
<Home />
|
</Route>
|
||||||
</Route>
|
<Route exact path="/farms/auction">
|
||||||
<Route exact path="/farms/auction">
|
<FarmAuction />
|
||||||
<FarmAuction />
|
</Route>
|
||||||
</Route>
|
<Route path="/farms">
|
||||||
<Route path="/farms">
|
<Farms />
|
||||||
<Farms />
|
</Route>
|
||||||
</Route>
|
<Route path="/pools">
|
||||||
<Route path="/pools">
|
<Pools />
|
||||||
<Pools />
|
</Route>
|
||||||
</Route>
|
<Route path="/referral">
|
||||||
<Route path="/referral">
|
<Referral />
|
||||||
<Referral />
|
</Route>
|
||||||
</Route>
|
<Route path="/board">
|
||||||
<Route path="/board">
|
<Board />
|
||||||
<Board />
|
</Route>
|
||||||
</Route>
|
<Route path="/nft">
|
||||||
<Route path="/nft">
|
<Nft />
|
||||||
<Nft />
|
</Route>
|
||||||
</Route>
|
<Route path="/announcement">
|
||||||
<Route path="/announcement">
|
<Announcement />
|
||||||
<Announcement />
|
</Route>
|
||||||
</Route>
|
{/* <Route path="/lottery">
|
||||||
{/* <Route path="/lottery">
|
|
||||||
<Lottery />
|
<Lottery />
|
||||||
</Route>
|
</Route>
|
||||||
<Route path="/ifo">
|
<Route path="/ifo">
|
||||||
|
|
@ -149,7 +146,7 @@ const App: React.FC = () => {
|
||||||
</Route>
|
</Route>
|
||||||
|
|
||||||
{/* Using this format because these components use routes injected props. We need to rework them with hooks */}
|
{/* Using this format because these components use routes injected props. We need to rework them with hooks */}
|
||||||
{/* <Route exact strict path="/swap" component={Swap} />
|
{/* <Route exact strict path="/swap" component={Swap} />
|
||||||
<Route exact strict path="/swap/:outputCurrency" component={RedirectToSwap} />
|
<Route exact strict path="/swap/:outputCurrency" component={RedirectToSwap} />
|
||||||
<Route exact strict path="/send" component={RedirectPathToSwapOnly} />
|
<Route exact strict path="/send" component={RedirectPathToSwapOnly} />
|
||||||
<Route exact strict path="/find" component={PoolFinder} />
|
<Route exact strict path="/find" component={PoolFinder} />
|
||||||
|
|
@ -166,8 +163,8 @@ const App: React.FC = () => {
|
||||||
<Route exact strict path="/nft" component={Nft} />
|
<Route exact strict path="/nft" component={Nft} />
|
||||||
<Route exact strict path="/announcement" component={Announcement} /> */}
|
<Route exact strict path="/announcement" component={Announcement} /> */}
|
||||||
|
|
||||||
{/* Redirect */}
|
{/* Redirect */}
|
||||||
{/* <Route path="/staking">
|
{/* <Route path="/staking">
|
||||||
<Redirect to="/pools" />
|
<Redirect to="/pools" />
|
||||||
</Route>
|
</Route>
|
||||||
<Route path="/syrup">
|
<Route path="/syrup">
|
||||||
|
|
@ -177,16 +174,15 @@ const App: React.FC = () => {
|
||||||
<Redirect to="/collectibles" />
|
<Redirect to="/collectibles" />
|
||||||
</Route> */}
|
</Route> */}
|
||||||
|
|
||||||
{/* 404 */}
|
{/* 404 */}
|
||||||
<Route component={NotFound} />
|
<Route component={NotFound} />
|
||||||
</Switch>
|
</Switch>
|
||||||
</SuspenseWithChunkError>
|
</SuspenseWithChunkError>
|
||||||
</Menu>
|
</Menu>
|
||||||
<EasterEgg iterations={2} />
|
<EasterEgg iterations={2} />
|
||||||
<ToastListener />
|
<ToastListener />
|
||||||
<DatePickerPortal />
|
<DatePickerPortal />
|
||||||
</Router>
|
</Router>
|
||||||
</ConfigProvider>
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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 (
|
||||||
|
<ConfigProvider t={t}>
|
||||||
|
<ModalProvider>{children}</ModalProvider>
|
||||||
|
</ConfigProvider>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default ConfigProviders
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
import React from 'react'
|
import React from 'react'
|
||||||
import { ModalProvider } from '@pancakeswap/uikit'
|
|
||||||
import { Web3ReactProvider } from '@web3-react/core'
|
import { Web3ReactProvider } from '@web3-react/core'
|
||||||
import { HelmetProvider } from 'react-helmet-async'
|
import { HelmetProvider } from 'react-helmet-async'
|
||||||
import { Provider } from 'react-redux'
|
import { Provider } from 'react-redux'
|
||||||
|
|
@ -9,6 +8,7 @@ import { LanguageProvider } from 'contexts/Localization'
|
||||||
import { RefreshContextProvider } from 'contexts/RefreshContext'
|
import { RefreshContextProvider } from 'contexts/RefreshContext'
|
||||||
import { ToastsProvider } from 'contexts/ToastsContext'
|
import { ToastsProvider } from 'contexts/ToastsContext'
|
||||||
import store from 'state'
|
import store from 'state'
|
||||||
|
import ConfigProviders from './ConfigProviders'
|
||||||
|
|
||||||
const Providers: React.FC = ({ children }) => {
|
const Providers: React.FC = ({ children }) => {
|
||||||
return (
|
return (
|
||||||
|
|
@ -19,7 +19,7 @@ const Providers: React.FC = ({ children }) => {
|
||||||
<ThemeContextProvider>
|
<ThemeContextProvider>
|
||||||
<LanguageProvider>
|
<LanguageProvider>
|
||||||
<RefreshContextProvider>
|
<RefreshContextProvider>
|
||||||
<ModalProvider>{children}</ModalProvider>
|
<ConfigProviders>{children}</ConfigProviders>
|
||||||
</RefreshContextProvider>
|
</RefreshContextProvider>
|
||||||
</LanguageProvider>
|
</LanguageProvider>
|
||||||
</ThemeContextProvider>
|
</ThemeContextProvider>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue