diff --git a/src/components/CurrencyInputPanel/index.tsx b/src/components/CurrencyInputPanel/index.tsx index 01282e5715..badf705a62 100644 --- a/src/components/CurrencyInputPanel/index.tsx +++ b/src/components/CurrencyInputPanel/index.tsx @@ -260,7 +260,7 @@ export default function CurrencyInputPanel({ {!hideInput && !hideBalance && ( - {account && ( + {account ? ( (Max) ) : null} + ) : ( + '-' )} diff --git a/src/components/NavigationTabs/index.tsx b/src/components/NavigationTabs/index.tsx index 25d8647299..86b595a24d 100644 --- a/src/components/NavigationTabs/index.tsx +++ b/src/components/NavigationTabs/index.tsx @@ -6,7 +6,6 @@ import { NavLink, Link as HistoryLink } from 'react-router-dom' import { ArrowLeft } from 'react-feather' import { RowBetween } from '../Row' -// import QuestionHelper from '../QuestionHelper' import Settings from '../Settings' import { useDispatch } from 'react-redux' import { AppDispatch } from 'state' @@ -86,7 +85,15 @@ export function FindPoolTabs({ origin }: { origin: string }) { ) } -export function AddRemoveTabs({ adding, creating }: { adding: boolean; creating: boolean }) { +export function AddRemoveTabs({ + adding, + creating, + positionID, +}: { + adding: boolean + creating: boolean + positionID?: string | undefined +}) { const theme = useTheme() // reset states on back @@ -96,7 +103,7 @@ export function AddRemoveTabs({ adding, creating }: { adding: boolean; creating: { adding && dispatch(resetMintState()) }} diff --git a/src/components/PositionCard/index.tsx b/src/components/PositionCard/index.tsx index 15b2f3d023..cd5c78e231 100644 --- a/src/components/PositionCard/index.tsx +++ b/src/components/PositionCard/index.tsx @@ -213,12 +213,12 @@ export default function FullPositionCard({ pair, border, stakedBalance }: Positi > {showMore ? ( <> - Manage + Migrate ) : ( <> - Manage + Migrate )} diff --git a/src/components/PositionListItem/index.tsx b/src/components/PositionListItem/index.tsx index 480934c254..29ccbd95bc 100644 --- a/src/components/PositionListItem/index.tsx +++ b/src/components/PositionListItem/index.tsx @@ -283,6 +283,7 @@ export default function PositionListItem({ positionDetails }: PositionListItemPr <> { + e.preventDefault() e.stopPropagation() setManuallyInverted(!manuallyInverted) }} diff --git a/src/components/PositionPreview/index.tsx b/src/components/PositionPreview/index.tsx index 88617e7897..7fc14a427b 100644 --- a/src/components/PositionPreview/index.tsx +++ b/src/components/PositionPreview/index.tsx @@ -42,6 +42,7 @@ export const PositionPreview = ({ : currency0 : currency0 ) + const sorted = baseCurrency === currency0 const quoteCurrency = sorted ? currency1 : currency0 diff --git a/src/pages/AddLiquidity/index.tsx b/src/pages/AddLiquidity/index.tsx index 4116122dac..ab0fbbe0ad 100644 --- a/src/pages/AddLiquidity/index.tsx +++ b/src/pages/AddLiquidity/index.tsx @@ -1,4 +1,4 @@ -import React, { useCallback, useContext, useMemo, useState } from 'react' +import React, { useCallback, useContext, useMemo, useState, useEffect } from 'react' import { TransactionResponse } from '@ethersproject/providers' import { Currency, TokenAmount, ETHER, currencyEquals } from '@uniswap/sdk-core' import { WETH9 } from '@uniswap/sdk-core' @@ -89,6 +89,13 @@ export default function AddLiquidity({ [currencyA, currencyB, baseCurrency] ) + useEffect(() => { + setBaseCurrency(currencyA) + return () => { + setBaseCurrency(undefined) + } + }, [currencyA, currencyB]) + // mint state const { independentField, typedValue, startPriceTypedValue } = useMintState() @@ -371,7 +378,7 @@ export default function AddLiquidity({ pendingText={pendingText} /> - + {!hasExistingPosition && ( @@ -383,7 +390,6 @@ export default function AddLiquidity({ Clear All - { onFieldAInput(maxAmounts[Field.CURRENCY_A]?.toExact() ?? '') }} - onCurrencySelect={handleCurrencyASelect} showMaxButton={!atMaxAmounts[Field.CURRENCY_A]} currency={currencies[Field.CURRENCY_A]} id="add-liquidity-input-tokena" @@ -576,7 +581,6 @@ export default function AddLiquidity({ { onFieldBInput(maxAmounts[Field.CURRENCY_B]?.toExact() ?? '') }} diff --git a/src/pages/MigrateV2/MigrateV2Pair.tsx b/src/pages/MigrateV2/MigrateV2Pair.tsx index 2b77b6b856..a43776ec1e 100644 --- a/src/pages/MigrateV2/MigrateV2Pair.tsx +++ b/src/pages/MigrateV2/MigrateV2Pair.tsx @@ -1,4 +1,4 @@ -import React, { useCallback, useMemo, useState } from 'react' +import React, { useCallback, useEffect, useMemo, useState } from 'react' import { Fraction, Price, Token, TokenAmount, WETH9 } from '@uniswap/sdk-core' import { FACTORY_ADDRESS, JSBI } from '@uniswap/v2-sdk' import { Redirect, RouteComponentProps } from 'react-router' @@ -163,6 +163,11 @@ function V2PairMigration({ baseToken ) + // reset the initial state, dont need cleanup token always defined + useEffect(() => { + setBaseToken(token0) + }, [baseToken, token0]) + // get value and prices at ticks const { [Bound.LOWER]: tickLower, [Bound.UPPER]: tickUpper } = ticks const { [Bound.LOWER]: priceLower, [Bound.UPPER]: priceUpper } = pricesAtTicks diff --git a/src/pages/RemoveLiquidity/V3.tsx b/src/pages/RemoveLiquidity/V3.tsx index 9abad52db3..5d74f54d67 100644 --- a/src/pages/RemoveLiquidity/V3.tsx +++ b/src/pages/RemoveLiquidity/V3.tsx @@ -272,7 +272,7 @@ function Remove({ tokenId }: { tokenId: BigNumber }) { pendingText={pendingText} /> - + {position ? (