2020-05-19 02:23:58 +03:00
|
|
|
import React, { Suspense } from 'react'
|
2020-09-24 19:18:57 +03:00
|
|
|
import { Route, Switch } from 'react-router-dom'
|
2020-05-19 02:23:58 +03:00
|
|
|
import styled from 'styled-components'
|
|
|
|
import GoogleAnalyticsReporter from '../components/analytics/GoogleAnalyticsReporter'
|
2020-09-24 19:18:57 +03:00
|
|
|
import AddressClaimModal from '../components/claim/AddressClaimModal'
|
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'
|
|
|
|
import URLWarning from '../components/Header/URLWarning'
|
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 { ApplicationModal } from '../state/application/actions'
|
|
|
|
import { useModalOpen, useToggleModal } from '../state/application/hooks'
|
2020-05-19 02:23:58 +03:00
|
|
|
import DarkModeQueryParamReader from '../theme/DarkModeQueryParamReader'
|
2021-04-14 17:12:35 +03:00
|
|
|
import { RedirectDuplicateTokenIds } from './AddLiquidity/redirects'
|
2020-09-24 19:18:57 +03:00
|
|
|
import Earn from './Earn'
|
|
|
|
import Manage from './Earn/Manage'
|
2021-03-04 01:21:14 +03:00
|
|
|
import MigrateV2 from './MigrateV2'
|
2021-04-09 21:01:56 +03:00
|
|
|
import MigrateV2Pair from './MigrateV2/MigrateV2Pair'
|
2020-05-08 19:05:52 +03:00
|
|
|
import Pool from './Pool'
|
2021-03-04 01:21:14 +03:00
|
|
|
import PoolV2 from './Pool/v2'
|
2020-05-20 22:00:33 +03:00
|
|
|
import PoolFinder from './PoolFinder'
|
|
|
|
import RemoveLiquidity from './RemoveLiquidity'
|
2021-04-09 21:01:56 +03:00
|
|
|
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'
|
|
|
|
import Vote from './Vote'
|
|
|
|
import VotePage from './Vote/VotePage'
|
2021-04-14 17:12:35 +03:00
|
|
|
import { RedirectDuplicateTokenIdsV2 } from './AddLiquidityV2/redirects'
|
2021-04-16 22:33:26 +03:00
|
|
|
import { PositionPage } from './Pool/PositionPage'
|
2021-04-23 05:58:03 +03:00
|
|
|
import AddLiquidity from './AddLiquidity'
|
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;
|
2021-04-14 17:12:35 +03:00
|
|
|
/* overflow-x: hidden; */
|
2019-08-07 21:58:29 +03:00
|
|
|
`
|
|
|
|
|
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-03-09 04:52:36 +03:00
|
|
|
padding-top: 160px;
|
2019-08-07 21:58:29 +03:00
|
|
|
align-items: center;
|
|
|
|
flex: 1;
|
2021-04-14 17:12:35 +03:00
|
|
|
/* overflow-y: auto; */
|
|
|
|
/* overflow-x: hidden; */
|
2020-05-01 04:14:29 +03:00
|
|
|
|
2021-04-23 20:03:06 +03:00
|
|
|
z-index: 1;
|
|
|
|
|
2020-09-24 19:18:57 +03:00
|
|
|
${({ theme }) => theme.mediaWidth.upToSmall`
|
|
|
|
padding: 16px;
|
|
|
|
padding-top: 2rem;
|
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 (
|
2020-05-20 22:00:33 +03:00
|
|
|
<Suspense fallback={null}>
|
2020-09-24 19:18:57 +03:00
|
|
|
<Route component={GoogleAnalyticsReporter} />
|
|
|
|
<Route component={DarkModeQueryParamReader} />
|
|
|
|
<AppWrapper>
|
|
|
|
<URLWarning />
|
|
|
|
<HeaderWrapper>
|
|
|
|
<Header />
|
|
|
|
</HeaderWrapper>
|
|
|
|
<BodyWrapper>
|
|
|
|
<Popups />
|
|
|
|
<Polling />
|
|
|
|
<TopLevelModals />
|
|
|
|
<Web3ReactManager>
|
|
|
|
<Switch>
|
2021-04-09 21:01:56 +03:00
|
|
|
<Route exact strict path="/vote" component={Vote} />
|
|
|
|
<Route exact strict path="/vote/:id" component={VotePage} />
|
2020-09-24 19:18:57 +03:00
|
|
|
<Route exact strict path="/claim" component={OpenClaimAddressModalAndRedirectToSwap} />
|
2021-04-09 21:01:56 +03:00
|
|
|
<Route exact strict path="/uni" component={Earn} />
|
|
|
|
<Route exact strict path="/uni/:currencyIdA/:currencyIdB" component={Manage} />
|
|
|
|
|
2020-09-24 19:18:57 +03:00
|
|
|
<Route exact strict path="/send" component={RedirectPathToSwapOnly} />
|
2021-04-09 21:01:56 +03:00
|
|
|
<Route exact strict path="/swap/:outputCurrency" component={RedirectToSwap} />
|
|
|
|
<Route exact strict path="/swap" component={Swap} />
|
|
|
|
|
2020-09-24 19:18:57 +03:00
|
|
|
<Route exact strict path="/find" component={PoolFinder} />
|
2021-04-09 21:01:56 +03:00
|
|
|
<Route exact strict path="/pool/v2" component={PoolV2} />
|
2020-09-24 19:18:57 +03:00
|
|
|
<Route exact strict path="/pool" component={Pool} />
|
2021-04-23 05:58:03 +03:00
|
|
|
<Route exact strict path="/pool/:tokenId" component={PositionPage} />
|
2021-04-14 17:12:35 +03:00
|
|
|
|
|
|
|
<Route exact strict path="/add/v2/:currencyIdA?/:currencyIdB?" component={RedirectDuplicateTokenIdsV2} />
|
|
|
|
<Route
|
|
|
|
exact
|
|
|
|
strict
|
|
|
|
path="/add/:currencyIdA?/:currencyIdB?/:feeAmount?"
|
|
|
|
component={RedirectDuplicateTokenIds}
|
|
|
|
/>
|
|
|
|
|
2021-04-23 05:58:03 +03:00
|
|
|
<Route
|
|
|
|
exact
|
|
|
|
strict
|
|
|
|
path="/increase/:currencyIdA?/:currencyIdB?/:feeAmount?/:tokenId?"
|
|
|
|
component={AddLiquidity}
|
|
|
|
/>
|
|
|
|
|
2021-04-09 21:01:56 +03:00
|
|
|
<Route exact strict path="/remove/v2/:currencyIdA/:currencyIdB" component={RemoveLiquidity} />
|
2021-04-20 22:31:31 +03:00
|
|
|
<Route exact strict path="/remove/:tokenId" component={RemoveLiquidityV3} />
|
2021-04-09 21:01:56 +03:00
|
|
|
|
2021-03-04 01:21:14 +03:00
|
|
|
<Route exact strict path="/migrate/v2" component={MigrateV2} />
|
2021-04-09 21:01:56 +03:00
|
|
|
<Route exact strict path="/migrate/v2/:address" component={MigrateV2Pair} />
|
|
|
|
|
2020-09-24 19:18:57 +03:00
|
|
|
<Route component={RedirectPathToSwapOnly} />
|
|
|
|
</Switch>
|
|
|
|
</Web3ReactManager>
|
|
|
|
<Marginer />
|
|
|
|
</BodyWrapper>
|
|
|
|
</AppWrapper>
|
2020-05-20 22:00:33 +03:00
|
|
|
</Suspense>
|
2019-05-30 23:42:25 +03:00
|
|
|
)
|
2018-10-07 00:24:17 +03:00
|
|
|
}
|