multiple bug fixes (#141)
* multiple bug fixes * remove unused local * disable currency select on bottom liquidity
This commit is contained in:
parent
4220cafbd3
commit
2339817170
@ -260,7 +260,7 @@ export default function CurrencyInputPanel({
|
||||
{!hideInput && !hideBalance && (
|
||||
<FiatRow>
|
||||
<RowBetween>
|
||||
{account && (
|
||||
{account ? (
|
||||
<RowFixed style={{ height: '17px' }}>
|
||||
<TYPE.body
|
||||
onClick={onMax}
|
||||
@ -280,6 +280,8 @@ export default function CurrencyInputPanel({
|
||||
<StyledBalanceMax onClick={onMax}>(Max)</StyledBalanceMax>
|
||||
) : null}
|
||||
</RowFixed>
|
||||
) : (
|
||||
'-'
|
||||
)}
|
||||
|
||||
<FiatValue fiatValue={fiatValue} priceImpact={priceImpact} />
|
||||
|
@ -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:
|
||||
<Tabs>
|
||||
<RowBetween style={{ padding: '1rem 1rem 0 1rem' }}>
|
||||
<HistoryLink
|
||||
to="/pool"
|
||||
to={'/pool' + (!!positionID ? `/${positionID.toString()}` : '')}
|
||||
onClick={() => {
|
||||
adding && dispatch(resetMintState())
|
||||
}}
|
||||
|
@ -213,12 +213,12 @@ export default function FullPositionCard({ pair, border, stakedBalance }: Positi
|
||||
>
|
||||
{showMore ? (
|
||||
<>
|
||||
Manage
|
||||
Migrate
|
||||
<ChevronUp size="20" style={{ marginLeft: '10px' }} />
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
Manage
|
||||
Migrate
|
||||
<ChevronDown size="20" style={{ marginLeft: '10px' }} />
|
||||
</>
|
||||
)}
|
||||
|
@ -283,6 +283,7 @@ export default function PositionListItem({ positionDetails }: PositionListItemPr
|
||||
<>
|
||||
<RangeLineItem
|
||||
onClick={(e) => {
|
||||
e.preventDefault()
|
||||
e.stopPropagation()
|
||||
setManuallyInverted(!manuallyInverted)
|
||||
}}
|
||||
|
@ -42,6 +42,7 @@ export const PositionPreview = ({
|
||||
: currency0
|
||||
: currency0
|
||||
)
|
||||
|
||||
const sorted = baseCurrency === currency0
|
||||
const quoteCurrency = sorted ? currency1 : currency0
|
||||
|
||||
|
@ -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}
|
||||
/>
|
||||
<AppBody>
|
||||
<AddRemoveTabs creating={false} adding={true} />
|
||||
<AddRemoveTabs creating={false} adding={true} positionID={tokenId} />
|
||||
<Wrapper>
|
||||
<AutoColumn gap="32px">
|
||||
{!hasExistingPosition && (
|
||||
@ -383,7 +390,6 @@ export default function AddLiquidity({
|
||||
<TYPE.blue fontSize="12px">Clear All</TYPE.blue>
|
||||
</ButtonText>
|
||||
</RowBetween>
|
||||
|
||||
<RowBetween>
|
||||
<CurrencyDropdown
|
||||
value={formattedAmounts[Field.CURRENCY_A]}
|
||||
@ -565,7 +571,6 @@ export default function AddLiquidity({
|
||||
onMax={() => {
|
||||
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({
|
||||
<CurrencyInputPanel
|
||||
value={formattedAmounts[Field.CURRENCY_B]}
|
||||
onUserInput={onFieldBInput}
|
||||
onCurrencySelect={handleCurrencyBSelect}
|
||||
onMax={() => {
|
||||
onFieldBInput(maxAmounts[Field.CURRENCY_B]?.toExact() ?? '')
|
||||
}}
|
||||
|
@ -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
|
||||
|
@ -272,7 +272,7 @@ function Remove({ tokenId }: { tokenId: BigNumber }) {
|
||||
pendingText={pendingText}
|
||||
/>
|
||||
<AppBody>
|
||||
<AddRemoveTabs creating={false} adding={false} />
|
||||
<AddRemoveTabs creating={false} adding={false} positionID={tokenId.toString()} />
|
||||
<Wrapper>
|
||||
{position ? (
|
||||
<AutoColumn gap="lg">
|
||||
|
Loading…
Reference in New Issue
Block a user