2020-05-19 02:23:58 +03:00
|
|
|
import React, { Suspense } from 'react'
|
2020-05-21 00:10:26 +03:00
|
|
|
import { BrowserRouter, HashRouter, 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'
|
|
|
|
import Footer from '../components/Footer'
|
2019-04-15 19:56:40 +03:00
|
|
|
import Header from '../components/Header'
|
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'
|
|
|
|
import DarkModeQueryParamReader from '../theme/DarkModeQueryParamReader'
|
2020-05-20 22:00:33 +03:00
|
|
|
import AddLiquidity from './AddLiquidity'
|
|
|
|
import CreatePool from './CreatePool'
|
2020-05-08 19:05:52 +03:00
|
|
|
import Pool from './Pool'
|
2020-05-20 22:00:33 +03:00
|
|
|
import PoolFinder from './PoolFinder'
|
|
|
|
import RemoveLiquidity from './RemoveLiquidity'
|
2020-05-19 02:23:58 +03:00
|
|
|
import Send from './Send'
|
|
|
|
import Swap from './Swap'
|
2020-05-20 22:00:33 +03:00
|
|
|
import { RedirectPathToSwapOnly, RedirectToSwap } from './Swap/redirects'
|
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;
|
2020-04-23 00:22:13 +03:00
|
|
|
overflow-x: hidden;
|
2019-08-07 21:58:29 +03:00
|
|
|
`
|
|
|
|
|
2019-05-30 23:42:25 +03:00
|
|
|
const HeaderWrapper = styled.div`
|
|
|
|
${({ theme }) => theme.flexRowNoWrap}
|
|
|
|
width: 100%;
|
|
|
|
justify-content: space-between;
|
|
|
|
`
|
2018-10-27 10:54:52 +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%;
|
2020-05-06 03:40:59 +03:00
|
|
|
padding-top: 160px;
|
2019-08-07 21:58:29 +03:00
|
|
|
align-items: center;
|
|
|
|
flex: 1;
|
2020-05-20 22:00:33 +03:00
|
|
|
overflow-y: auto;
|
|
|
|
overflow-x: hidden;
|
2020-05-06 03:40:59 +03:00
|
|
|
z-index: 10;
|
2020-05-01 04:14:29 +03:00
|
|
|
|
2020-05-06 22:34:06 +03:00
|
|
|
${({ theme }) => theme.mediaWidth.upToExtraSmall`
|
2020-05-16 17:44:26 +03:00
|
|
|
padding: 16px;
|
2020-05-06 22:34:06 +03:00
|
|
|
`};
|
|
|
|
|
2020-05-01 04:14:29 +03:00
|
|
|
z-index: 1;
|
2019-05-30 23:42:25 +03:00
|
|
|
`
|
2019-04-25 19:12:47 +03:00
|
|
|
|
2020-05-20 22:00:33 +03:00
|
|
|
const BackgroundGradient = styled.div`
|
2020-05-06 03:40:59 +03:00
|
|
|
width: 100%;
|
2020-06-02 19:28:35 +03:00
|
|
|
height: 100vh;
|
2020-05-11 22:12:38 +03:00
|
|
|
background: ${({ theme }) => `radial-gradient(50% 50% at 50% 50%, ${theme.primary1} 0%, ${theme.bg1} 100%)`};
|
2020-05-06 03:40:59 +03:00
|
|
|
position: absolute;
|
|
|
|
top: 0px;
|
|
|
|
left: 0px;
|
|
|
|
opacity: 0.1;
|
|
|
|
z-index: -1;
|
|
|
|
|
|
|
|
transform: translateY(-70vh);
|
|
|
|
|
|
|
|
@media (max-width: 960px) {
|
|
|
|
height: 300px;
|
|
|
|
width: 100%;
|
|
|
|
transform: translateY(-150px);
|
|
|
|
}
|
2019-05-30 23:42:25 +03:00
|
|
|
`
|
2019-04-25 19:12:47 +03:00
|
|
|
|
2020-05-27 18:42:25 +03:00
|
|
|
const Marginer = styled.div`
|
|
|
|
margin-top: 5rem;
|
|
|
|
`
|
|
|
|
|
2020-05-21 00:10:26 +03:00
|
|
|
let Router: React.ComponentType
|
|
|
|
if (process.env.PUBLIC_URL === '.') {
|
|
|
|
Router = HashRouter
|
|
|
|
} else {
|
|
|
|
Router = BrowserRouter
|
|
|
|
}
|
|
|
|
|
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-05-21 00:10:26 +03:00
|
|
|
<Router>
|
2020-05-20 22:00:33 +03:00
|
|
|
<Route component={GoogleAnalyticsReporter} />
|
|
|
|
<Route component={DarkModeQueryParamReader} />
|
|
|
|
<AppWrapper>
|
|
|
|
<HeaderWrapper>
|
|
|
|
<Header />
|
|
|
|
</HeaderWrapper>
|
|
|
|
<BodyWrapper>
|
|
|
|
<Popups />
|
|
|
|
<Web3ReactManager>
|
|
|
|
<Switch>
|
|
|
|
<Route exact strict path="/swap" component={Swap} />
|
|
|
|
<Route exact strict path="/swap/:outputCurrency" component={RedirectToSwap} />
|
|
|
|
<Route exact strict path="/send" component={Send} />
|
|
|
|
<Route exact strict path="/find" component={PoolFinder} />
|
|
|
|
<Route exact strict path="/pool" component={Pool} />
|
|
|
|
<Route exact strict path="/create" component={CreatePool} />
|
|
|
|
<Route exact strict path="/add/:tokens" component={AddLiquidity} />
|
|
|
|
<Route exact strict path="/remove/:tokens" component={RemoveLiquidity} />
|
|
|
|
<Route component={RedirectPathToSwapOnly} />
|
|
|
|
</Switch>
|
|
|
|
</Web3ReactManager>
|
2020-05-27 18:42:25 +03:00
|
|
|
<Marginer />
|
2020-05-20 22:00:33 +03:00
|
|
|
<Footer />
|
|
|
|
</BodyWrapper>
|
|
|
|
<BackgroundGradient />
|
|
|
|
</AppWrapper>
|
2020-05-21 00:10:26 +03:00
|
|
|
</Router>
|
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
|
|
|
}
|