2021-11-18 09:01:45 +03:00
|
|
|
import Loader from 'components/Loader'
|
2021-07-07 17:59:31 +03:00
|
|
|
import ApeModeQueryParamReader from 'hooks/useApeModeQueryParamReader'
|
2021-11-18 09:01:45 +03:00
|
|
|
import { lazy, Suspense } from 'react'
|
|
|
|
import { Redirect, Route, Switch } from 'react-router-dom'
|
2021-05-13 16:15:13 +03:00
|
|
|
import styled from 'styled-components/macro'
|
2021-09-22 02:21:28 +03:00
|
|
|
|
2020-05-19 02:23:58 +03:00
|
|
|
import GoogleAnalyticsReporter from '../components/analytics/GoogleAnalyticsReporter'
|
2020-09-24 19:18:57 +03:00
|
|
|
import AddressClaimModal from '../components/claim/AddressClaimModal'
|
2021-07-07 17:59:31 +03:00
|
|
|
import ErrorBoundary from '../components/ErrorBoundary'
|
2019-04-15 19:56:40 +03:00
|
|
|
import Header from '../components/Header'
|
2020-09-24 19:18:57 +03:00
|
|
|
import Polling from '../components/Header/Polling'
|
2020-04-23 00:22:13 +03:00
|
|
|
import Popups from '../components/Popups'
|
2020-05-19 02:23:58 +03:00
|
|
|
import Web3ReactManager from '../components/Web3ReactManager'
|
2020-09-24 19:18:57 +03:00
|
|
|
import { useModalOpen, useToggleModal } from '../state/application/hooks'
|
2021-10-14 20:40:19 +03:00
|
|
|
import { ApplicationModal } from '../state/application/reducer'
|
2020-05-19 02:23:58 +03:00
|
|
|
import DarkModeQueryParamReader from '../theme/DarkModeQueryParamReader'
|
2021-07-07 17:59:31 +03:00
|
|
|
import AddLiquidity from './AddLiquidity'
|
2021-04-14 17:12:35 +03:00
|
|
|
import { RedirectDuplicateTokenIds } from './AddLiquidity/redirects'
|
2021-07-07 17:59:31 +03:00
|
|
|
import { RedirectDuplicateTokenIdsV2 } from './AddLiquidityV2/redirects'
|
2021-05-17 21:24:31 +03:00
|
|
|
import Earn from './Earn'
|
|
|
|
import Manage from './Earn/Manage'
|
|
|
|
import MigrateV2 from './MigrateV2'
|
|
|
|
import MigrateV2Pair from './MigrateV2/MigrateV2Pair'
|
|
|
|
import Pool from './Pool'
|
2021-07-07 17:59:31 +03:00
|
|
|
import { PositionPage } from './Pool/PositionPage'
|
2021-05-17 21:24:31 +03:00
|
|
|
import PoolV2 from './Pool/v2'
|
|
|
|
import PoolFinder from './PoolFinder'
|
|
|
|
import RemoveLiquidity from './RemoveLiquidity'
|
|
|
|
import RemoveLiquidityV3 from './RemoveLiquidity/V3'
|
2020-05-19 02:23:58 +03:00
|
|
|
import Swap from './Swap'
|
2020-09-24 19:18:57 +03:00
|
|
|
import { OpenClaimAddressModalAndRedirectToSwap, RedirectPathToSwapOnly, RedirectToSwap } from './Swap/redirects'
|
2021-11-18 09:01:45 +03:00
|
|
|
|
|
|
|
const Vote = lazy(() => import('./Vote'))
|
2018-10-27 10:54:52 +03:00
|
|
|
|
2019-08-07 21:58:29 +03:00
|
|
|
const AppWrapper = styled.div`
|
|
|
|
display: flex;
|
|
|
|
flex-flow: column;
|
|
|
|
align-items: flex-start;
|
|
|
|
`
|
|
|
|
|
2019-05-30 23:42:25 +03:00
|
|
|
const BodyWrapper = styled.div`
|
2019-08-07 21:58:29 +03:00
|
|
|
display: flex;
|
|
|
|
flex-direction: column;
|
2019-05-30 23:42:25 +03:00
|
|
|
width: 100%;
|
2021-06-22 22:51:32 +03:00
|
|
|
padding: 120px 16px 0px 16px;
|
2019-08-07 21:58:29 +03:00
|
|
|
align-items: center;
|
|
|
|
flex: 1;
|
2021-04-23 20:03:06 +03:00
|
|
|
z-index: 1;
|
|
|
|
|
2020-09-24 19:18:57 +03:00
|
|
|
${({ theme }) => theme.mediaWidth.upToSmall`
|
2021-07-16 22:28:19 +03:00
|
|
|
padding: 6rem 16px 16px 16px;
|
2020-05-06 22:34:06 +03:00
|
|
|
`};
|
2019-05-30 23:42:25 +03:00
|
|
|
`
|
2019-04-25 19:12:47 +03:00
|
|
|
|
2021-03-09 04:52:36 +03:00
|
|
|
const HeaderWrapper = styled.div`
|
|
|
|
${({ theme }) => theme.flexRowNoWrap}
|
|
|
|
width: 100%;
|
|
|
|
justify-content: space-between;
|
|
|
|
position: fixed;
|
|
|
|
top: 0;
|
|
|
|
z-index: 2;
|
|
|
|
`
|
|
|
|
|
2020-05-27 18:42:25 +03:00
|
|
|
const Marginer = styled.div`
|
|
|
|
margin-top: 5rem;
|
|
|
|
`
|
|
|
|
|
2020-09-24 19:18:57 +03:00
|
|
|
function TopLevelModals() {
|
|
|
|
const open = useModalOpen(ApplicationModal.ADDRESS_CLAIM)
|
|
|
|
const toggle = useToggleModal(ApplicationModal.ADDRESS_CLAIM)
|
|
|
|
return <AddressClaimModal isOpen={open} onDismiss={toggle} />
|
|
|
|
}
|
|
|
|
|
2019-05-30 23:42:25 +03:00
|
|
|
export default function App() {
|
|
|
|
return (
|
2021-05-11 19:09:01 +03:00
|
|
|
<ErrorBoundary>
|
2021-06-01 05:36:56 +03:00
|
|
|
<Route component={GoogleAnalyticsReporter} />
|
|
|
|
<Route component={DarkModeQueryParamReader} />
|
|
|
|
<Route component={ApeModeQueryParamReader} />
|
2021-07-16 22:28:19 +03:00
|
|
|
<Web3ReactManager>
|
|
|
|
<AppWrapper>
|
|
|
|
<HeaderWrapper>
|
|
|
|
<Header />
|
|
|
|
</HeaderWrapper>
|
|
|
|
<BodyWrapper>
|
|
|
|
<Popups />
|
|
|
|
<Polling />
|
|
|
|
<TopLevelModals />
|
2021-11-18 09:01:45 +03:00
|
|
|
<Suspense fallback={<Loader />}>
|
|
|
|
<Switch>
|
|
|
|
<Route strict path="/vote" component={Vote} />
|
|
|
|
<Route exact strict path="/create-proposal">
|
|
|
|
<Redirect to="/vote/create-proposal" />
|
|
|
|
</Route>
|
|
|
|
<Route exact strict path="/claim" component={OpenClaimAddressModalAndRedirectToSwap} />
|
|
|
|
<Route exact strict path="/uni" component={Earn} />
|
|
|
|
<Route exact strict path="/uni/:currencyIdA/:currencyIdB" component={Manage} />
|
|
|
|
|
|
|
|
<Route exact strict path="/send" component={RedirectPathToSwapOnly} />
|
|
|
|
<Route exact strict path="/swap/:outputCurrency" component={RedirectToSwap} />
|
|
|
|
<Route exact strict path="/swap" component={Swap} />
|
|
|
|
|
|
|
|
<Route exact strict path="/pool/v2/find" component={PoolFinder} />
|
|
|
|
<Route exact strict path="/pool/v2" component={PoolV2} />
|
|
|
|
<Route exact strict path="/pool" component={Pool} />
|
|
|
|
<Route exact strict path="/pool/:tokenId" component={PositionPage} />
|
|
|
|
|
|
|
|
<Route
|
|
|
|
exact
|
|
|
|
strict
|
|
|
|
path="/add/v2/:currencyIdA?/:currencyIdB?"
|
|
|
|
component={RedirectDuplicateTokenIdsV2}
|
|
|
|
/>
|
|
|
|
<Route
|
|
|
|
exact
|
|
|
|
strict
|
|
|
|
path="/add/:currencyIdA?/:currencyIdB?/:feeAmount?"
|
|
|
|
component={RedirectDuplicateTokenIds}
|
|
|
|
/>
|
|
|
|
|
|
|
|
<Route
|
|
|
|
exact
|
|
|
|
strict
|
|
|
|
path="/increase/:currencyIdA?/:currencyIdB?/:feeAmount?/:tokenId?"
|
|
|
|
component={AddLiquidity}
|
|
|
|
/>
|
|
|
|
|
|
|
|
<Route exact strict path="/remove/v2/:currencyIdA/:currencyIdB" component={RemoveLiquidity} />
|
|
|
|
<Route exact strict path="/remove/:tokenId" component={RemoveLiquidityV3} />
|
|
|
|
|
|
|
|
<Route exact strict path="/migrate/v2" component={MigrateV2} />
|
|
|
|
<Route exact strict path="/migrate/v2/:address" component={MigrateV2Pair} />
|
|
|
|
|
|
|
|
<Route component={RedirectPathToSwapOnly} />
|
|
|
|
</Switch>
|
|
|
|
</Suspense>
|
2021-07-16 22:28:19 +03:00
|
|
|
<Marginer />
|
|
|
|
</BodyWrapper>
|
|
|
|
</AppWrapper>
|
|
|
|
</Web3ReactManager>
|
2021-05-11 19:09:01 +03:00
|
|
|
</ErrorBoundary>
|
2019-05-30 23:42:25 +03:00
|
|
|
)
|
2018-10-07 00:24:17 +03:00
|
|
|
}
|