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 && (
|
{!hideInput && !hideBalance && (
|
||||||
<FiatRow>
|
<FiatRow>
|
||||||
<RowBetween>
|
<RowBetween>
|
||||||
{account && (
|
{account ? (
|
||||||
<RowFixed style={{ height: '17px' }}>
|
<RowFixed style={{ height: '17px' }}>
|
||||||
<TYPE.body
|
<TYPE.body
|
||||||
onClick={onMax}
|
onClick={onMax}
|
||||||
@ -280,6 +280,8 @@ export default function CurrencyInputPanel({
|
|||||||
<StyledBalanceMax onClick={onMax}>(Max)</StyledBalanceMax>
|
<StyledBalanceMax onClick={onMax}>(Max)</StyledBalanceMax>
|
||||||
) : null}
|
) : null}
|
||||||
</RowFixed>
|
</RowFixed>
|
||||||
|
) : (
|
||||||
|
'-'
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<FiatValue fiatValue={fiatValue} priceImpact={priceImpact} />
|
<FiatValue fiatValue={fiatValue} priceImpact={priceImpact} />
|
||||||
|
@ -6,7 +6,6 @@ import { NavLink, Link as HistoryLink } from 'react-router-dom'
|
|||||||
|
|
||||||
import { ArrowLeft } from 'react-feather'
|
import { ArrowLeft } from 'react-feather'
|
||||||
import { RowBetween } from '../Row'
|
import { RowBetween } from '../Row'
|
||||||
// import QuestionHelper from '../QuestionHelper'
|
|
||||||
import Settings from '../Settings'
|
import Settings from '../Settings'
|
||||||
import { useDispatch } from 'react-redux'
|
import { useDispatch } from 'react-redux'
|
||||||
import { AppDispatch } from 'state'
|
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()
|
const theme = useTheme()
|
||||||
|
|
||||||
// reset states on back
|
// reset states on back
|
||||||
@ -96,7 +103,7 @@ export function AddRemoveTabs({ adding, creating }: { adding: boolean; creating:
|
|||||||
<Tabs>
|
<Tabs>
|
||||||
<RowBetween style={{ padding: '1rem 1rem 0 1rem' }}>
|
<RowBetween style={{ padding: '1rem 1rem 0 1rem' }}>
|
||||||
<HistoryLink
|
<HistoryLink
|
||||||
to="/pool"
|
to={'/pool' + (!!positionID ? `/${positionID.toString()}` : '')}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
adding && dispatch(resetMintState())
|
adding && dispatch(resetMintState())
|
||||||
}}
|
}}
|
||||||
|
@ -213,12 +213,12 @@ export default function FullPositionCard({ pair, border, stakedBalance }: Positi
|
|||||||
>
|
>
|
||||||
{showMore ? (
|
{showMore ? (
|
||||||
<>
|
<>
|
||||||
Manage
|
Migrate
|
||||||
<ChevronUp size="20" style={{ marginLeft: '10px' }} />
|
<ChevronUp size="20" style={{ marginLeft: '10px' }} />
|
||||||
</>
|
</>
|
||||||
) : (
|
) : (
|
||||||
<>
|
<>
|
||||||
Manage
|
Migrate
|
||||||
<ChevronDown size="20" style={{ marginLeft: '10px' }} />
|
<ChevronDown size="20" style={{ marginLeft: '10px' }} />
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
|
@ -283,6 +283,7 @@ export default function PositionListItem({ positionDetails }: PositionListItemPr
|
|||||||
<>
|
<>
|
||||||
<RangeLineItem
|
<RangeLineItem
|
||||||
onClick={(e) => {
|
onClick={(e) => {
|
||||||
|
e.preventDefault()
|
||||||
e.stopPropagation()
|
e.stopPropagation()
|
||||||
setManuallyInverted(!manuallyInverted)
|
setManuallyInverted(!manuallyInverted)
|
||||||
}}
|
}}
|
||||||
|
@ -42,6 +42,7 @@ export const PositionPreview = ({
|
|||||||
: currency0
|
: currency0
|
||||||
: currency0
|
: currency0
|
||||||
)
|
)
|
||||||
|
|
||||||
const sorted = baseCurrency === currency0
|
const sorted = baseCurrency === currency0
|
||||||
const quoteCurrency = sorted ? currency1 : 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 { TransactionResponse } from '@ethersproject/providers'
|
||||||
import { Currency, TokenAmount, ETHER, currencyEquals } from '@uniswap/sdk-core'
|
import { Currency, TokenAmount, ETHER, currencyEquals } from '@uniswap/sdk-core'
|
||||||
import { WETH9 } from '@uniswap/sdk-core'
|
import { WETH9 } from '@uniswap/sdk-core'
|
||||||
@ -89,6 +89,13 @@ export default function AddLiquidity({
|
|||||||
[currencyA, currencyB, baseCurrency]
|
[currencyA, currencyB, baseCurrency]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
setBaseCurrency(currencyA)
|
||||||
|
return () => {
|
||||||
|
setBaseCurrency(undefined)
|
||||||
|
}
|
||||||
|
}, [currencyA, currencyB])
|
||||||
|
|
||||||
// mint state
|
// mint state
|
||||||
const { independentField, typedValue, startPriceTypedValue } = useMintState()
|
const { independentField, typedValue, startPriceTypedValue } = useMintState()
|
||||||
|
|
||||||
@ -371,7 +378,7 @@ export default function AddLiquidity({
|
|||||||
pendingText={pendingText}
|
pendingText={pendingText}
|
||||||
/>
|
/>
|
||||||
<AppBody>
|
<AppBody>
|
||||||
<AddRemoveTabs creating={false} adding={true} />
|
<AddRemoveTabs creating={false} adding={true} positionID={tokenId} />
|
||||||
<Wrapper>
|
<Wrapper>
|
||||||
<AutoColumn gap="32px">
|
<AutoColumn gap="32px">
|
||||||
{!hasExistingPosition && (
|
{!hasExistingPosition && (
|
||||||
@ -383,7 +390,6 @@ export default function AddLiquidity({
|
|||||||
<TYPE.blue fontSize="12px">Clear All</TYPE.blue>
|
<TYPE.blue fontSize="12px">Clear All</TYPE.blue>
|
||||||
</ButtonText>
|
</ButtonText>
|
||||||
</RowBetween>
|
</RowBetween>
|
||||||
|
|
||||||
<RowBetween>
|
<RowBetween>
|
||||||
<CurrencyDropdown
|
<CurrencyDropdown
|
||||||
value={formattedAmounts[Field.CURRENCY_A]}
|
value={formattedAmounts[Field.CURRENCY_A]}
|
||||||
@ -565,7 +571,6 @@ export default function AddLiquidity({
|
|||||||
onMax={() => {
|
onMax={() => {
|
||||||
onFieldAInput(maxAmounts[Field.CURRENCY_A]?.toExact() ?? '')
|
onFieldAInput(maxAmounts[Field.CURRENCY_A]?.toExact() ?? '')
|
||||||
}}
|
}}
|
||||||
onCurrencySelect={handleCurrencyASelect}
|
|
||||||
showMaxButton={!atMaxAmounts[Field.CURRENCY_A]}
|
showMaxButton={!atMaxAmounts[Field.CURRENCY_A]}
|
||||||
currency={currencies[Field.CURRENCY_A]}
|
currency={currencies[Field.CURRENCY_A]}
|
||||||
id="add-liquidity-input-tokena"
|
id="add-liquidity-input-tokena"
|
||||||
@ -576,7 +581,6 @@ export default function AddLiquidity({
|
|||||||
<CurrencyInputPanel
|
<CurrencyInputPanel
|
||||||
value={formattedAmounts[Field.CURRENCY_B]}
|
value={formattedAmounts[Field.CURRENCY_B]}
|
||||||
onUserInput={onFieldBInput}
|
onUserInput={onFieldBInput}
|
||||||
onCurrencySelect={handleCurrencyBSelect}
|
|
||||||
onMax={() => {
|
onMax={() => {
|
||||||
onFieldBInput(maxAmounts[Field.CURRENCY_B]?.toExact() ?? '')
|
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 { Fraction, Price, Token, TokenAmount, WETH9 } from '@uniswap/sdk-core'
|
||||||
import { FACTORY_ADDRESS, JSBI } from '@uniswap/v2-sdk'
|
import { FACTORY_ADDRESS, JSBI } from '@uniswap/v2-sdk'
|
||||||
import { Redirect, RouteComponentProps } from 'react-router'
|
import { Redirect, RouteComponentProps } from 'react-router'
|
||||||
@ -163,6 +163,11 @@ function V2PairMigration({
|
|||||||
baseToken
|
baseToken
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// reset the initial state, dont need cleanup token always defined
|
||||||
|
useEffect(() => {
|
||||||
|
setBaseToken(token0)
|
||||||
|
}, [baseToken, token0])
|
||||||
|
|
||||||
// get value and prices at ticks
|
// get value and prices at ticks
|
||||||
const { [Bound.LOWER]: tickLower, [Bound.UPPER]: tickUpper } = ticks
|
const { [Bound.LOWER]: tickLower, [Bound.UPPER]: tickUpper } = ticks
|
||||||
const { [Bound.LOWER]: priceLower, [Bound.UPPER]: priceUpper } = pricesAtTicks
|
const { [Bound.LOWER]: priceLower, [Bound.UPPER]: priceUpper } = pricesAtTicks
|
||||||
|
@ -272,7 +272,7 @@ function Remove({ tokenId }: { tokenId: BigNumber }) {
|
|||||||
pendingText={pendingText}
|
pendingText={pendingText}
|
||||||
/>
|
/>
|
||||||
<AppBody>
|
<AppBody>
|
||||||
<AddRemoveTabs creating={false} adding={false} />
|
<AddRemoveTabs creating={false} adding={false} positionID={tokenId.toString()} />
|
||||||
<Wrapper>
|
<Wrapper>
|
||||||
{position ? (
|
{position ? (
|
||||||
<AutoColumn gap="lg">
|
<AutoColumn gap="lg">
|
||||||
|
Loading…
Reference in New Issue
Block a user