Skip to content

Commit

Permalink
Elastic UI
Browse files Browse the repository at this point in the history
  • Loading branch information
viet-nv committed Jun 24, 2024
1 parent 2053736 commit bf78478
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 26 deletions.
21 changes: 1 addition & 20 deletions src/components/ClassicElasticTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,11 @@ import { Trans } from '@lingui/macro'
import { rgba } from 'polished'
import { useEffect } from 'react'
import { isMobile } from 'react-device-detect'
import { useLocation, useNavigate, useSearchParams } from 'react-router-dom'
import { useLocation, useSearchParams } from 'react-router-dom'
import { useMedia } from 'react-use'
import { Flex, Text } from 'rebass'

import { ReactComponent as DropdownSVG } from 'assets/svg/down.svg'
import ElasticHackedModal from 'components/ElasticHackedModal'
import { APP_PATHS } from 'constants/index'
import { CLASSIC_NOT_SUPPORTED, ELASTIC_NOT_SUPPORTED } from 'constants/networks'
import { VERSION } from 'constants/v2'
Expand All @@ -23,12 +22,10 @@ import { PoolClassicIcon, PoolElasticIcon } from './Icons'
import { MouseoverTooltip } from './Tooltip'

function ClassicElasticTab() {
const navigate = useNavigate()
const theme = useTheme()
const location = useLocation()
const [searchParams, setSearchParams] = useSearchParams()
const isFarmPage = location.pathname.startsWith(APP_PATHS.FARMS)
const isMyPoolPage = location.pathname.startsWith(APP_PATHS.MY_POOLS)

const { positions, farmPositions } = useElasticLegacy(false)
const { claimInfo } = useElasticCompensationData(false)
Expand All @@ -43,8 +40,6 @@ function ClassicElasticTab() {
const notSupportedElasticMsg = ELASTIC_NOT_SUPPORTED()[chainId]
const notSupportedClassicMsg = CLASSIC_NOT_SUPPORTED()[chainId]

const isOpenElasticHacked = !isMyPoolPage && tab === VERSION.ELASTIC

const upToMedium = useMedia(`(max-width: ${MEDIA_WIDTHS.upToMedium}px)`)

const dontShowLegacy = [
Expand Down Expand Up @@ -272,20 +267,6 @@ function ClassicElasticTab() {
</Text>
</Flex>
</MouseoverTooltip>

<ElasticHackedModal
isOpen={isOpenElasticHacked}
onClose={() => {
if (notSupportedClassicMsg) {
navigate({ pathname: APP_PATHS.MY_POOLS })
} else {
handleSwitchTab(VERSION.CLASSIC)
}
}}
onConfirm={() => {
navigate({ pathname: APP_PATHS.MY_POOLS })
}}
/>
</Flex>
)
}
Expand Down
19 changes: 13 additions & 6 deletions src/pages/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,17 @@ const SwapV3 = lazy(() => import('./SwapV3'))
const PartnerSwap = lazy(() => import('./PartnerSwap'))
// const Bridge = lazy(() => import('./Bridge'))
const MyPool = lazy(() => import('./MyPool'))
const Pools = lazy(() => import('./Pools'))

const Farm = lazy(() => import('./Farm'))

const PoolFinder = lazy(() => import('./PoolFinder'))
const ElasticRemoveLiquidity = lazy(() => import('pages/RemoveLiquidityProAmm'))
// const RedirectCreatePool = lazy(() => import('pages/CreatePool/RedirectCreatePool'))

const RedirectElasticCreatePool = lazy(() => import('pages/AddLiquidityV2/RedirectElasticCreatePool'))

const ElasticIncreaseLiquidity = lazy(() => import('pages/IncreaseLiquidity'))

const RemoveLiquidity = lazy(() => import('pages/RemoveLiquidity'))

Expand Down Expand Up @@ -160,7 +166,6 @@ const RoutesWithNetworkPrefix = () => {

{!ELASTIC_NOT_SUPPORTED()[chainId] && (
<>
{/*
<Route
path={`${APP_PATHS.ELASTIC_CREATE_POOL}/:currencyIdA?/:currencyIdB?/:feeAmount?`}
element={<RedirectElasticCreatePool />}
Expand All @@ -169,7 +174,6 @@ const RoutesWithNetworkPrefix = () => {
path={`${APP_PATHS.ELASTIC_INCREASE_LIQ}/:currencyIdA?/:currencyIdB?/:feeAmount?/:tokenId?`}
element={<ElasticIncreaseLiquidity />}
/>
*/}
<Route path={`${APP_PATHS.ELASTIC_REMOVE_POOL}/:tokenId`} element={<ElasticRemoveLiquidity />} />
</>
)}
Expand Down Expand Up @@ -257,6 +261,11 @@ export default function App() {
)}

<Route path={`${APP_PATHS.FIND_POOL}`} element={<PoolFinder />} />
<>
{/* Pools Routes */}
<Route path={`${APP_PATHS.POOLS}`} element={<RedirectWithNetworkSuffix />} />
<Route path={`${APP_PATHS.POOLS}/:network/:currencyIdA?/:currencyIdB?`} element={<Pools />} />
</>
<>
{/* Farms Routes */}
<Route path={`${APP_PATHS.FARMS}`} element={<RedirectWithNetworkSuffix />} />
Expand All @@ -271,10 +280,8 @@ export default function App() {

<>
{/* These are old routes and will soon be deprecated - Check: RoutesWithNetworkParam */}
{/*
<Route path={`${APP_PATHS.ELASTIC_CREATE_POOL}/*`} element={<RedirectWithNetworkPrefix />} />
<Route path={`${APP_PATHS.ELASTIC_INCREASE_LIQ}/*`} element={<RedirectWithNetworkPrefix />} />
*/}
<Route path={`${APP_PATHS.ELASTIC_CREATE_POOL}/*`} element={<RedirectWithNetworkPrefix />} />
<Route path={`${APP_PATHS.ELASTIC_INCREASE_LIQ}/*`} element={<RedirectWithNetworkPrefix />} />

<Route path={`${APP_PATHS.ELASTIC_REMOVE_POOL}/*`} element={<RedirectWithNetworkPrefix />} />

Expand Down

0 comments on commit bf78478

Please sign in to comment.