Commit 37cf492d authored by Yuta Sugimura's avatar Yuta Sugimura Committed by GitHub

fix: Add SwitchLocaleLink to a page where it does not exist (#1867)

parent 9e93f809
This diff is collapsed.
...@@ -42,6 +42,7 @@ import { ConfirmAddModalBottom } from './ConfirmAddModalBottom' ...@@ -42,6 +42,7 @@ import { ConfirmAddModalBottom } from './ConfirmAddModalBottom'
import { currencyId } from '../../utils/currencyId' import { currencyId } from '../../utils/currencyId'
import { PoolPriceBar } from './PoolPriceBar' import { PoolPriceBar } from './PoolPriceBar'
import UnsupportedCurrencyFooter from 'components/swap/UnsupportedCurrencyFooter' import UnsupportedCurrencyFooter from 'components/swap/UnsupportedCurrencyFooter'
import { SwitchLocaleLink } from 'components/SwitchLocaleLink'
import { t, Trans } from '@lingui/macro' import { t, Trans } from '@lingui/macro'
const DEFAULT_ADD_V2_SLIPPAGE_TOLERANCE = new Percent(50, 10_000) const DEFAULT_ADD_V2_SLIPPAGE_TOLERANCE = new Percent(50, 10_000)
...@@ -485,6 +486,8 @@ export default function AddLiquidity({ ...@@ -485,6 +486,8 @@ export default function AddLiquidity({
</AutoColumn> </AutoColumn>
</Wrapper> </Wrapper>
</AppBody> </AppBody>
<SwitchLocaleLink />
{!addIsUnsupported ? ( {!addIsUnsupported ? (
pair && !noLiquidity && pairState !== PairState.INVALID ? ( pair && !noLiquidity && pairState !== PairState.INVALID ? (
<AutoColumn style={{ minWidth: '20rem', width: '100%', maxWidth: '400px', marginTop: '1rem' }}> <AutoColumn style={{ minWidth: '20rem', width: '100%', maxWidth: '400px', marginTop: '1rem' }}>
......
...@@ -16,6 +16,7 @@ import { Dots } from '../../components/swap/styleds' ...@@ -16,6 +16,7 @@ import { Dots } from '../../components/swap/styleds'
import { toV2LiquidityToken, useTrackedTokenPairs } from '../../state/user/hooks' import { toV2LiquidityToken, useTrackedTokenPairs } from '../../state/user/hooks'
import MigrateV2PositionCard from 'components/PositionCard/V2' import MigrateV2PositionCard from 'components/PositionCard/V2'
import MigrateSushiPositionCard from 'components/PositionCard/Sushi' import MigrateSushiPositionCard from 'components/PositionCard/Sushi'
import { SwitchLocaleLink } from 'components/SwitchLocaleLink'
import { PairState, useV2Pairs } from 'hooks/useV2Pairs' import { PairState, useV2Pairs } from 'hooks/useV2Pairs'
import { getCreate2Address } from '@ethersproject/address' import { getCreate2Address } from '@ethersproject/address'
import { pack, keccak256 } from '@ethersproject/solidity' import { pack, keccak256 } from '@ethersproject/solidity'
...@@ -110,73 +111,76 @@ export default function MigrateV2() { ...@@ -110,73 +111,76 @@ export default function MigrateV2() {
const v2IsLoading = fetchingPairBalances || v2Pairs.some(([pairState]) => pairState === PairState.LOADING) const v2IsLoading = fetchingPairBalances || v2Pairs.some(([pairState]) => pairState === PairState.LOADING)
return ( return (
<BodyWrapper style={{ padding: 24 }}> <>
<AutoColumn gap="16px"> <BodyWrapper style={{ padding: 24 }}>
<AutoRow style={{ alignItems: 'center', justifyContent: 'space-between' }} gap="8px"> <AutoColumn gap="16px">
<BackArrow to="/pool/v2" /> <AutoRow style={{ alignItems: 'center', justifyContent: 'space-between' }} gap="8px">
<TYPE.mediumHeader> <BackArrow to="/pool/v2" />
<Trans>Migrate V2 Liquidity</Trans> <TYPE.mediumHeader>
</TYPE.mediumHeader> <Trans>Migrate V2 Liquidity</Trans>
<div> </TYPE.mediumHeader>
<QuestionHelper text={<Trans>Migrate your liquidity tokens from Uniswap V2 to Uniswap V3.</Trans>} /> <div>
</div> <QuestionHelper text={<Trans>Migrate your liquidity tokens from Uniswap V2 to Uniswap V3.</Trans>} />
</AutoRow> </div>
</AutoRow>
<TYPE.body style={{ marginBottom: 8, fontWeight: 400 }}>
<Trans> <TYPE.body style={{ marginBottom: 8, fontWeight: 400 }}>
For each pool shown below, click migrate to remove your liquidity from Uniswap V2 and deposit it into
Uniswap V3.
</Trans>
</TYPE.body>
{!account ? (
<LightCard padding="40px">
<TYPE.body color={theme.text3} textAlign="center">
<Trans>Connect to a wallet to view your V2 liquidity.</Trans>
</TYPE.body>
</LightCard>
) : v2IsLoading ? (
<LightCard padding="40px">
<TYPE.body color={theme.text3} textAlign="center">
<Dots>
<Trans>Loading</Trans>
</Dots>
</TYPE.body>
</LightCard>
) : v2Pairs.filter(([, pair]) => !!pair).length > 0 ? (
<>
{v2Pairs
.filter(([, pair]) => !!pair)
.map(([, pair]) => (
<MigrateV2PositionCard key={(pair as Pair).liquidityToken.address} pair={pair as Pair} />
))}
{tokenPairsWithSushiBalance.map(({ sushiLiquidityToken, tokens }) => {
return (
<MigrateSushiPositionCard
key={(sushiLiquidityToken as Token).address}
tokenA={tokens[0]}
tokenB={tokens[1]}
liquidityToken={sushiLiquidityToken as Token}
/>
)
})}
</>
) : (
<EmptyState message={<Trans>No V2 Liquidity found.</Trans>} />
)}
<AutoColumn justify={'center'} gap="md">
<Text textAlign="center" fontSize={14} style={{ padding: '.5rem 0 .5rem 0' }}>
<Trans> <Trans>
Don’t see one of your v2 positions?{' '} For each pool shown below, click migrate to remove your liquidity from Uniswap V2 and deposit it into
<StyledInternalLink id="import-pool-link" to={'/find?origin=/migrate/v2'}> Uniswap V3.
Import it.
</StyledInternalLink>
</Trans> </Trans>
</Text> </TYPE.body>
{!account ? (
<LightCard padding="40px">
<TYPE.body color={theme.text3} textAlign="center">
<Trans>Connect to a wallet to view your V2 liquidity.</Trans>
</TYPE.body>
</LightCard>
) : v2IsLoading ? (
<LightCard padding="40px">
<TYPE.body color={theme.text3} textAlign="center">
<Dots>
<Trans>Loading</Trans>
</Dots>
</TYPE.body>
</LightCard>
) : v2Pairs.filter(([, pair]) => !!pair).length > 0 ? (
<>
{v2Pairs
.filter(([, pair]) => !!pair)
.map(([, pair]) => (
<MigrateV2PositionCard key={(pair as Pair).liquidityToken.address} pair={pair as Pair} />
))}
{tokenPairsWithSushiBalance.map(({ sushiLiquidityToken, tokens }) => {
return (
<MigrateSushiPositionCard
key={(sushiLiquidityToken as Token).address}
tokenA={tokens[0]}
tokenB={tokens[1]}
liquidityToken={sushiLiquidityToken as Token}
/>
)
})}
</>
) : (
<EmptyState message={<Trans>No V2 Liquidity found.</Trans>} />
)}
<AutoColumn justify={'center'} gap="md">
<Text textAlign="center" fontSize={14} style={{ padding: '.5rem 0 .5rem 0' }}>
<Trans>
Don’t see one of your v2 positions?{' '}
<StyledInternalLink id="import-pool-link" to={'/find?origin=/migrate/v2'}>
Import it.
</StyledInternalLink>
</Trans>
</Text>
</AutoColumn>
</AutoColumn> </AutoColumn>
</AutoColumn> </BodyWrapper>
</BodyWrapper> <SwitchLocaleLink />
</>
) )
} }
This diff is collapsed.
...@@ -19,6 +19,7 @@ import { useV2Pairs } from '../../hooks/useV2Pairs' ...@@ -19,6 +19,7 @@ import { useV2Pairs } from '../../hooks/useV2Pairs'
import { toV2LiquidityToken, useTrackedTokenPairs } from '../../state/user/hooks' import { toV2LiquidityToken, useTrackedTokenPairs } from '../../state/user/hooks'
import { Dots } from '../../components/swap/styleds' import { Dots } from '../../components/swap/styleds'
import { CardSection, DataCard, CardNoise, CardBGImage } from '../../components/earn/styled' import { CardSection, DataCard, CardNoise, CardBGImage } from '../../components/earn/styled'
import { SwitchLocaleLink } from '../../components/SwitchLocaleLink'
import { useStakingInfo } from '../../state/stake/hooks' import { useStakingInfo } from '../../state/stake/hooks'
import { BIG_INT_ZERO } from '../../constants/misc' import { BIG_INT_ZERO } from '../../constants/misc'
import { Pair } from '@uniswap/v2-sdk' import { Pair } from '@uniswap/v2-sdk'
...@@ -256,6 +257,7 @@ export default function Pool() { ...@@ -256,6 +257,7 @@ export default function Pool() {
</AutoColumn> </AutoColumn>
</AutoColumn> </AutoColumn>
</PageWrapper> </PageWrapper>
<SwitchLocaleLink />
</> </>
) )
} }
...@@ -11,6 +11,7 @@ import { FindPoolTabs } from '../../components/NavigationTabs' ...@@ -11,6 +11,7 @@ import { FindPoolTabs } from '../../components/NavigationTabs'
import { MinimalPositionCard } from '../../components/PositionCard' import { MinimalPositionCard } from '../../components/PositionCard'
import Row from '../../components/Row' import Row from '../../components/Row'
import CurrencySearchModal from '../../components/SearchModal/CurrencySearchModal' import CurrencySearchModal from '../../components/SearchModal/CurrencySearchModal'
import { SwitchLocaleLink } from '../../components/SwitchLocaleLink'
import { ExtendedEther } from '../../constants/tokens' import { ExtendedEther } from '../../constants/tokens'
import { PairState, useV2Pair } from '../../hooks/useV2Pairs' import { PairState, useV2Pair } from '../../hooks/useV2Pairs'
import { useActiveWeb3React } from '../../hooks/web3' import { useActiveWeb3React } from '../../hooks/web3'
...@@ -93,136 +94,139 @@ export default function PoolFinder() { ...@@ -93,136 +94,139 @@ export default function PoolFinder() {
) )
return ( return (
<AppBody> <>
<FindPoolTabs origin={query.get('origin') ?? '/pool/v2'} /> <AppBody>
<AutoColumn style={{ padding: '1rem' }} gap="md"> <FindPoolTabs origin={query.get('origin') ?? '/pool/v2'} />
<BlueCard> <AutoColumn style={{ padding: '1rem' }} gap="md">
<AutoColumn gap="10px"> <BlueCard>
<TYPE.link fontWeight={400} color={'primaryText1'}> <AutoColumn gap="10px">
<Trans> <TYPE.link fontWeight={400} color={'primaryText1'}>
<b>Tip:</b> Use this tool to find v2 pools that don&apos;t automatically appear in the interface. <Trans>
</Trans> <b>Tip:</b> Use this tool to find v2 pools that don&apos;t automatically appear in the interface.
</TYPE.link> </Trans>
</AutoColumn> </TYPE.link>
</BlueCard> </AutoColumn>
<ButtonDropdownLight </BlueCard>
onClick={() => { <ButtonDropdownLight
setShowSearch(true) onClick={() => {
setActiveField(Fields.TOKEN0) setShowSearch(true)
}} setActiveField(Fields.TOKEN0)
> }}
{currency0 ? ( >
<Row> {currency0 ? (
<CurrencyLogo currency={currency0} /> <Row>
<Text fontWeight={500} fontSize={20} marginLeft={'12px'}> <CurrencyLogo currency={currency0} />
{currency0.symbol} <Text fontWeight={500} fontSize={20} marginLeft={'12px'}>
</Text> {currency0.symbol}
</Row> </Text>
) : ( </Row>
<Text fontWeight={500} fontSize={20} marginLeft={'12px'}> ) : (
<Trans>Select a token</Trans>
</Text>
)}
</ButtonDropdownLight>
<ColumnCenter>
<Plus size="16" color="#888D9B" />
</ColumnCenter>
<ButtonDropdownLight
onClick={() => {
setShowSearch(true)
setActiveField(Fields.TOKEN1)
}}
>
{currency1 ? (
<Row>
<CurrencyLogo currency={currency1} />
<Text fontWeight={500} fontSize={20} marginLeft={'12px'}> <Text fontWeight={500} fontSize={20} marginLeft={'12px'}>
{currency1.symbol} <Trans>Select a token</Trans>
</Text> </Text>
</Row> )}
) : ( </ButtonDropdownLight>
<Text fontWeight={500} fontSize={20} marginLeft={'12px'}>
<Trans>Select a token</Trans>
</Text>
)}
</ButtonDropdownLight>
{hasPosition && ( <ColumnCenter>
<ColumnCenter <Plus size="16" color="#888D9B" />
style={{ justifyItems: 'center', backgroundColor: '', padding: '12px 0px', borderRadius: '12px' }}
>
<Text textAlign="center" fontWeight={500}>
<Trans>Pool Found!</Trans>
</Text>
<StyledInternalLink to={`/pool/v2`}>
<Text textAlign="center">
<Trans>Manage this pool.</Trans>
</Text>
</StyledInternalLink>
</ColumnCenter> </ColumnCenter>
)}
{currency0 && currency1 ? ( <ButtonDropdownLight
pairState === PairState.EXISTS ? ( onClick={() => {
hasPosition && pair ? ( setShowSearch(true)
<MinimalPositionCard pair={pair} border="1px solid #CED0D9" /> setActiveField(Fields.TOKEN1)
}}
>
{currency1 ? (
<Row>
<CurrencyLogo currency={currency1} />
<Text fontWeight={500} fontSize={20} marginLeft={'12px'}>
{currency1.symbol}
</Text>
</Row>
) : ( ) : (
<Text fontWeight={500} fontSize={20} marginLeft={'12px'}>
<Trans>Select a token</Trans>
</Text>
)}
</ButtonDropdownLight>
{hasPosition && (
<ColumnCenter
style={{ justifyItems: 'center', backgroundColor: '', padding: '12px 0px', borderRadius: '12px' }}
>
<Text textAlign="center" fontWeight={500}>
<Trans>Pool Found!</Trans>
</Text>
<StyledInternalLink to={`/pool/v2`}>
<Text textAlign="center">
<Trans>Manage this pool.</Trans>
</Text>
</StyledInternalLink>
</ColumnCenter>
)}
{currency0 && currency1 ? (
pairState === PairState.EXISTS ? (
hasPosition && pair ? (
<MinimalPositionCard pair={pair} border="1px solid #CED0D9" />
) : (
<LightCard padding="45px 10px">
<AutoColumn gap="sm" justify="center">
<Text textAlign="center">
<Trans>You don’t have liquidity in this pool yet.</Trans>
</Text>
<StyledInternalLink to={`/add/${currencyId(currency0)}/${currencyId(currency1)}`}>
<Text textAlign="center">
<Trans>Add liquidity.</Trans>
</Text>
</StyledInternalLink>
</AutoColumn>
</LightCard>
)
) : validPairNoLiquidity ? (
<LightCard padding="45px 10px"> <LightCard padding="45px 10px">
<AutoColumn gap="sm" justify="center"> <AutoColumn gap="sm" justify="center">
<Text textAlign="center"> <Text textAlign="center">
<Trans>You don’t have liquidity in this pool yet.</Trans> <Trans>No pool found.</Trans>
</Text> </Text>
<StyledInternalLink to={`/add/${currencyId(currency0)}/${currencyId(currency1)}`}> <StyledInternalLink to={`/add/${currencyId(currency0)}/${currencyId(currency1)}`}>
<Text textAlign="center"> <Trans>Create pool.</Trans>
<Trans>Add liquidity.</Trans>
</Text>
</StyledInternalLink> </StyledInternalLink>
</AutoColumn> </AutoColumn>
</LightCard> </LightCard>
) ) : pairState === PairState.INVALID ? (
) : validPairNoLiquidity ? ( <LightCard padding="45px 10px">
<LightCard padding="45px 10px"> <AutoColumn gap="sm" justify="center">
<AutoColumn gap="sm" justify="center"> <Text textAlign="center" fontWeight={500}>
<Text textAlign="center"> <Trans>Invalid pair.</Trans>
<Trans>No pool found.</Trans> </Text>
</Text> </AutoColumn>
<StyledInternalLink to={`/add/${currencyId(currency0)}/${currencyId(currency1)}`}> </LightCard>
<Trans>Create pool.</Trans> ) : pairState === PairState.LOADING ? (
</StyledInternalLink> <LightCard padding="45px 10px">
</AutoColumn> <AutoColumn gap="sm" justify="center">
</LightCard> <Text textAlign="center">
) : pairState === PairState.INVALID ? ( <Trans>Loading</Trans>
<LightCard padding="45px 10px"> <Dots />
<AutoColumn gap="sm" justify="center"> </Text>
<Text textAlign="center" fontWeight={500}> </AutoColumn>
<Trans>Invalid pair.</Trans> </LightCard>
</Text> ) : null
</AutoColumn> ) : (
</LightCard> prerequisiteMessage
) : pairState === PairState.LOADING ? ( )}
<LightCard padding="45px 10px"> </AutoColumn>
<AutoColumn gap="sm" justify="center">
<Text textAlign="center"> <CurrencySearchModal
<Trans>Loading</Trans> isOpen={showSearch}
<Dots /> onCurrencySelect={handleCurrencySelect}
</Text> onDismiss={handleSearchDismiss}
</AutoColumn> showCommonBases
</LightCard> selectedCurrency={(activeField === Fields.TOKEN0 ? currency1 : currency0) ?? undefined}
) : null />
) : ( </AppBody>
prerequisiteMessage <SwitchLocaleLink />
)} </>
</AutoColumn>
<CurrencySearchModal
isOpen={showSearch}
onCurrencySelect={handleCurrencySelect}
onDismiss={handleSearchDismiss}
showCommonBases
selectedCurrency={(activeField === Fields.TOKEN0 ? currency1 : currency0) ?? undefined}
/>
</AppBody>
) )
} }
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