Commit 568b05fd authored by Vignesh Mohankumar's avatar Vignesh Mohankumar Committed by GitHub

feat: support both /pool and /pools (#6173)

* more

* change locally
parent 3d0ca210
...@@ -43,7 +43,7 @@ For steps on local deployment, development, and code contribution, please see [C ...@@ -43,7 +43,7 @@ For steps on local deployment, development, and code contribution, please see [C
The Uniswap Interface supports swapping, adding liquidity, removing liquidity and migrating liquidity for Uniswap protocol V2. The Uniswap Interface supports swapping, adding liquidity, removing liquidity and migrating liquidity for Uniswap protocol V2.
- Swap on Uniswap V2: <https://app.uniswap.org/#/swap?use=v2> - Swap on Uniswap V2: <https://app.uniswap.org/#/swap?use=v2>
- View V2 liquidity: <https://app.uniswap.org/#/pool/v2> - View V2 liquidity: <https://app.uniswap.org/#/pools/v2>
- Add V2 liquidity: <https://app.uniswap.org/#/add/v2> - Add V2 liquidity: <https://app.uniswap.org/#/add/v2>
- Migrate V2 liquidity to V3: <https://app.uniswap.org/#/migrate/v2> - Migrate V2 liquidity to V3: <https://app.uniswap.org/#/migrate/v2>
......
...@@ -26,6 +26,6 @@ describe('Landing Page', () => { ...@@ -26,6 +26,6 @@ describe('Landing Page', () => {
it('allows navigation to pool', () => { it('allows navigation to pool', () => {
cy.get(getTestSelector('pool-nav-link')).first().click() cy.get(getTestSelector('pool-nav-link')).first().click()
cy.url().should('include', '/pool') cy.url().should('include', '/pools')
}) })
}) })
describe('Pool', () => { describe('Pool', () => {
beforeEach(() => { beforeEach(() => {
cy.visit('/pool').then(() => { cy.visit('/pools').then(() => {
cy.wait('@eth_blockNumber') cy.wait('@eth_blockNumber')
}) })
}) })
......
...@@ -2,7 +2,7 @@ import { getTestSelector } from '../utils' ...@@ -2,7 +2,7 @@ import { getTestSelector } from '../utils'
describe('Wallet Dropdown', () => { describe('Wallet Dropdown', () => {
before(() => { before(() => {
cy.visit('/pool') cy.visit('/pools')
}) })
it('should change the theme', () => { it('should change the theme', () => {
......
...@@ -149,7 +149,7 @@ export const AboutFooter = () => { ...@@ -149,7 +149,7 @@ export const AboutFooter = () => {
<TextLink to="/swap">Swap</TextLink> <TextLink to="/swap">Swap</TextLink>
<TextLink to="/tokens">Tokens</TextLink> <TextLink to="/tokens">Tokens</TextLink>
<TextLink to="/nfts">NFTs</TextLink> <TextLink to="/nfts">NFTs</TextLink>
<TextLink to="/pool">Pools</TextLink> <TextLink to="/pools">Pools</TextLink>
</LinkGroup> </LinkGroup>
<LinkGroup> <LinkGroup>
<LinkGroupTitle>Protocol</LinkGroupTitle> <LinkGroupTitle>Protocol</LinkGroupTitle>
......
...@@ -50,7 +50,7 @@ export const MORE_CARDS = [ ...@@ -50,7 +50,7 @@ export const MORE_CARDS = [
elementName: InterfaceElementName.ABOUT_PAGE_BUY_CRYPTO_CARD, elementName: InterfaceElementName.ABOUT_PAGE_BUY_CRYPTO_CARD,
}, },
{ {
to: '/pool', to: '/pools',
title: 'Earn', title: 'Earn',
description: 'Provide liquidity to pools on Uniswap and earn fees on swaps.', description: 'Provide liquidity to pools on Uniswap and earn fees on swaps.',
lightIcon: <StyledCardLogo src={lightArrowImgSrc} alt="Analytics" />, lightIcon: <StyledCardLogo src={lightArrowImgSrc} alt="Analytics" />,
......
...@@ -67,8 +67,8 @@ export const PageTabs = () => { ...@@ -67,8 +67,8 @@ export const PageTabs = () => {
<MenuItem dataTestId="nft-nav" href="/nfts" isActive={isNftPage}> <MenuItem dataTestId="nft-nav" href="/nfts" isActive={isNftPage}>
<Trans>NFTs</Trans> <Trans>NFTs</Trans>
</MenuItem> </MenuItem>
<MenuItem href="/pool" dataTestId="pool-nav-link" isActive={isPoolActive}> <MenuItem href="/pools" dataTestId="pool-nav-link" isActive={isPoolActive}>
<Trans>Pool</Trans> <Trans>Pools</Trans>
</MenuItem> </MenuItem>
</> </>
) )
......
...@@ -75,8 +75,8 @@ export function AddRemoveTabs({ ...@@ -75,8 +75,8 @@ export function AddRemoveTabs({
// detect if back should redirect to v3 or v2 pool page // detect if back should redirect to v3 or v2 pool page
const poolLink = location.pathname.includes('add/v2') const poolLink = location.pathname.includes('add/v2')
? '/pool/v2' ? '/pools/v2'
: '/pool' + (positionID ? `/${positionID.toString()}` : '') : '/pools' + (positionID ? `/${positionID.toString()}` : '')
return ( return (
<Tabs> <Tabs>
......
...@@ -210,7 +210,7 @@ export default function PositionListItem({ ...@@ -210,7 +210,7 @@ export default function PositionListItem({
// check if price is within range // check if price is within range
const outOfRange: boolean = pool ? pool.tickCurrent < tickLower || pool.tickCurrent >= tickUpper : false const outOfRange: boolean = pool ? pool.tickCurrent < tickLower || pool.tickCurrent >= tickUpper : false
const positionSummaryLink = '/pool/' + tokenId const positionSummaryLink = '/pools/' + tokenId
const removed = liquidity?.eq(0) const removed = liquidity?.eq(0)
......
...@@ -3,7 +3,7 @@ import { useLocation } from 'react-router-dom' ...@@ -3,7 +3,7 @@ import { useLocation } from 'react-router-dom'
export function useIsPoolPage() { export function useIsPoolPage() {
const { pathname } = useLocation() const { pathname } = useLocation()
return ( return (
pathname.startsWith('/pool') || pathname.startsWith('/pools') ||
pathname.startsWith('/add') || pathname.startsWith('/add') ||
pathname.startsWith('/remove') || pathname.startsWith('/remove') ||
pathname.startsWith('/increase') pathname.startsWith('/increase')
......
...@@ -372,7 +372,7 @@ export default function AddLiquidity() { ...@@ -372,7 +372,7 @@ export default function AddLiquidity() {
if (txHash) { if (txHash) {
onFieldAInput('') onFieldAInput('')
// dont jump to pool page if creating // dont jump to pool page if creating
navigate('/pool') navigate('/pools')
} }
setTxHash('') setTxHash('')
}, [navigate, onFieldAInput, txHash]) }, [navigate, onFieldAInput, txHash])
......
...@@ -97,6 +97,7 @@ function getCurrentPageFromLocation(locationPathname: string): InterfacePageName ...@@ -97,6 +97,7 @@ function getCurrentPageFromLocation(locationPathname: string): InterfacePageName
return InterfacePageName.SWAP_PAGE return InterfacePageName.SWAP_PAGE
case locationPathname.startsWith('/vote'): case locationPathname.startsWith('/vote'):
return InterfacePageName.VOTE_PAGE return InterfacePageName.VOTE_PAGE
case locationPathname.startsWith('/pools'):
case locationPathname.startsWith('/pool'): case locationPathname.startsWith('/pool'):
return InterfacePageName.POOL_PAGE return InterfacePageName.POOL_PAGE
case locationPathname.startsWith('/tokens'): case locationPathname.startsWith('/tokens'):
...@@ -237,6 +238,11 @@ export default function App() { ...@@ -237,6 +238,11 @@ export default function App() {
<Route path="pool" element={<Pool />} /> <Route path="pool" element={<Pool />} />
<Route path="pool/:tokenId" element={<PositionPage />} /> <Route path="pool/:tokenId" element={<PositionPage />} />
<Route path="pools/v2/find" element={<PoolFinder />} />
<Route path="pools/v2" element={<PoolV2 />} />
<Route path="pools" element={<Pool />} />
<Route path="pools/:tokenId" element={<PositionPage />} />
<Route path="add/v2" element={<RedirectDuplicateTokenIdsV2 />}> <Route path="add/v2" element={<RedirectDuplicateTokenIdsV2 />}>
<Route path=":currencyIdA" /> <Route path=":currencyIdA" />
<Route path=":currencyIdA/:currencyIdB" /> <Route path=":currencyIdA/:currencyIdB" />
......
...@@ -116,7 +116,7 @@ export default function MigrateV2() { ...@@ -116,7 +116,7 @@ export default function MigrateV2() {
<BodyWrapper style={{ padding: 24 }}> <BodyWrapper style={{ padding: 24 }}>
<AutoColumn gap="16px"> <AutoColumn gap="16px">
<AutoRow style={{ alignItems: 'center', justifyContent: 'space-between' }} gap="8px"> <AutoRow style={{ alignItems: 'center', justifyContent: 'space-between' }} gap="8px">
<BackArrow to="/pool" /> <BackArrow to="/pools" />
<ThemedText.DeprecatedMediumHeader> <ThemedText.DeprecatedMediumHeader>
<Trans>Migrate V2 Liquidity</Trans> <Trans>Migrate V2 Liquidity</Trans>
</ThemedText.DeprecatedMediumHeader> </ThemedText.DeprecatedMediumHeader>
...@@ -173,7 +173,7 @@ export default function MigrateV2() { ...@@ -173,7 +173,7 @@ export default function MigrateV2() {
<Text textAlign="center" fontSize={14} style={{ padding: '.5rem 0 .5rem 0' }}> <Text textAlign="center" fontSize={14} style={{ padding: '.5rem 0 .5rem 0' }}>
<Trans> <Trans>
Don’t see one of your v2 positions?{' '} Don’t see one of your v2 positions?{' '}
<StyledInternalLink id="import-pool-link" to="/pool/v2/find"> <StyledInternalLink id="import-pool-link" to="/pools/v2/find">
Import it. Import it.
</StyledInternalLink> </StyledInternalLink>
</Trans> </Trans>
......
...@@ -616,7 +616,7 @@ export function PositionPage() { ...@@ -616,7 +616,7 @@ export function PositionPage() {
<Link <Link
data-cy="visit-pool" data-cy="visit-pool"
style={{ textDecoration: 'none', width: 'fit-content', marginBottom: '0.5rem' }} style={{ textDecoration: 'none', width: 'fit-content', marginBottom: '0.5rem' }}
to="/pool" to="/pools"
> >
<HoverText> <HoverText>
<Trans>← Back to Pools</Trans> <Trans>← Back to Pools</Trans>
......
...@@ -241,7 +241,7 @@ export default function Pool() { ...@@ -241,7 +241,7 @@ export default function Pool() {
<Layers size={16} /> <Layers size={16} />
</PoolMenuItem> </PoolMenuItem>
), ),
link: '/pool/v2', link: '/pools/v2',
external: false, external: false,
}, },
{ {
......
...@@ -199,7 +199,7 @@ export default function Pool() { ...@@ -199,7 +199,7 @@ export default function Pool() {
<ResponsiveButtonSecondary as={Link} padding="6px 8px" to="/add/v2/ETH"> <ResponsiveButtonSecondary as={Link} padding="6px 8px" to="/add/v2/ETH">
<Trans>Create a pair</Trans> <Trans>Create a pair</Trans>
</ResponsiveButtonSecondary> </ResponsiveButtonSecondary>
<ResponsiveButtonPrimary id="find-pool-button" as={Link} to="/pool/v2/find" padding="6px 8px"> <ResponsiveButtonPrimary id="find-pool-button" as={Link} to="/pools/v2/find" padding="6px 8px">
<Text fontWeight={500} fontSize={16}> <Text fontWeight={500} fontSize={16}>
<Trans>Import Pool</Trans> <Trans>Import Pool</Trans>
</Text> </Text>
......
...@@ -100,7 +100,7 @@ export default function PoolFinder() { ...@@ -100,7 +100,7 @@ export default function PoolFinder() {
<Trace page={InterfacePageName.POOL_PAGE} shouldLogImpression> <Trace page={InterfacePageName.POOL_PAGE} shouldLogImpression>
<> <>
<AppBody> <AppBody>
<FindPoolTabs origin={query.get('origin') ?? '/pool/v2'} /> <FindPoolTabs origin={query.get('origin') ?? '/pools/v2'} />
<AutoColumn style={{ padding: '1rem' }} gap="md"> <AutoColumn style={{ padding: '1rem' }} gap="md">
<BlueCard> <BlueCard>
<AutoColumn gap="10px"> <AutoColumn gap="10px">
...@@ -162,7 +162,7 @@ export default function PoolFinder() { ...@@ -162,7 +162,7 @@ export default function PoolFinder() {
<Text textAlign="center" fontWeight={500}> <Text textAlign="center" fontWeight={500}>
<Trans>Pool Found!</Trans> <Trans>Pool Found!</Trans>
</Text> </Text>
<StyledInternalLink to="/pool/v2"> <StyledInternalLink to="pools/v2">
<Text textAlign="center"> <Text textAlign="center">
<Trans>Manage this pool.</Trans> <Trans>Manage this pool.</Trans>
</Text> </Text>
......
...@@ -55,7 +55,7 @@ export default function RemoveLiquidityV3() { ...@@ -55,7 +55,7 @@ export default function RemoveLiquidityV3() {
}, [tokenId]) }, [tokenId])
if (parsedTokenId === null || parsedTokenId.eq(0)) { if (parsedTokenId === null || parsedTokenId.eq(0)) {
return <Navigate to={{ ...location, pathname: '/pool' }} replace /> return <Navigate to={{ ...location, pathname: '/pools' }} replace />
} }
return <Remove tokenId={parsedTokenId} /> return <Remove tokenId={parsedTokenId} />
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment