Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
I
interface
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
LuckySwap
interface
Commits
6e52a435
Unverified
Commit
6e52a435
authored
May 20, 2021
by
Moody Salem
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: remove the click to flip price on the position list item
fixes
https://github.com/Uniswap/uniswap-interface/issues/1436
parent
d4c5d3e8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
49 deletions
+30
-49
index.tsx
src/components/HoverInlineText/index.tsx
+1
-2
index.tsx
src/components/PositionListItem/index.tsx
+29
-47
No files found.
src/components/HoverInlineText/index.tsx
View file @
6e52a435
...
@@ -3,7 +3,6 @@ import React, { useState } from 'react'
...
@@ -3,7 +3,6 @@ import React, { useState } from 'react'
import
styled
from
'
styled-components/macro
'
import
styled
from
'
styled-components/macro
'
const
TextWrapper
=
styled
.
span
<
{
margin
:
boolean
;
link
?:
boolean
;
fontSize
?:
string
;
adjustSize
?:
boolean
}
>
`
const
TextWrapper
=
styled
.
span
<
{
margin
:
boolean
;
link
?:
boolean
;
fontSize
?:
string
;
adjustSize
?:
boolean
}
>
`
cursor: auto;
margin-left:
${({
margin
})
=>
margin
&&
'
4px
'
}
;
margin-left:
${({
margin
})
=>
margin
&&
'
4px
'
}
;
color:
${({
theme
,
link
})
=>
(
link
?
theme
.
blue1
:
theme
.
text1
)}
;
color:
${({
theme
,
link
})
=>
(
link
?
theme
.
blue1
:
theme
.
text1
)}
;
font-size:
${({
fontSize
})
=>
fontSize
??
'
inherit
'
};
font-size:
${({
fontSize
})
=>
fontSize
??
'
inherit
'
};
...
@@ -22,7 +21,7 @@ const HoverInlineText = ({
...
@@ -22,7 +21,7 @@ const HoverInlineText = ({
link
,
link
,
...
rest
...
rest
}:
{
}:
{
text
:
string
text
?
:
string
maxCharacters
?:
number
maxCharacters
?:
number
margin
?:
boolean
margin
?:
boolean
adjustSize
?:
boolean
adjustSize
?:
boolean
...
...
src/components/PositionListItem/index.tsx
View file @
6e52a435
import
React
,
{
useMemo
,
useState
}
from
'
react
'
import
React
,
{
useMemo
}
from
'
react
'
import
{
Position
}
from
'
@uniswap/v3-sdk
'
import
{
Position
}
from
'
@uniswap/v3-sdk
'
import
Badge
from
'
components/Badge
'
import
Badge
from
'
components/Badge
'
import
DoubleCurrencyLogo
from
'
components/DoubleLogo
'
import
DoubleCurrencyLogo
from
'
components/DoubleLogo
'
...
@@ -17,10 +17,12 @@ import { RowFixed } from 'components/Row'
...
@@ -17,10 +17,12 @@ import { RowFixed } from 'components/Row'
import
HoverInlineText
from
'
components/HoverInlineText
'
import
HoverInlineText
from
'
components/HoverInlineText
'
import
{
DAI
,
USDC
,
USDT
,
WBTC
}
from
'
../../constants/tokens
'
import
{
DAI
,
USDC
,
USDT
,
WBTC
}
from
'
../../constants/tokens
'
const
Row
=
styled
(
Link
)
`
const
Link
Row
=
styled
(
Link
)
`
align-items: center;
align-items: center;
border-radius: 20px;
border-radius: 20px;
display: flex;
display: flex;
cursor: pointer;
user-select: none;
justify-content: space-between;
justify-content: space-between;
color:
${({
theme
})
=>
theme
.
text1
}
;
color:
${({
theme
})
=>
theme
.
text1
}
;
margin: 8px 0;
margin: 8px 0;
...
@@ -50,6 +52,7 @@ const Row = styled(Link)`
...
@@ -50,6 +52,7 @@ const Row = styled(Link)`
row-gap: 24px;
row-gap: 24px;
`
}
;
`
}
;
`
`
const
BadgeText
=
styled
.
div
`
const
BadgeText
=
styled
.
div
`
font-weight: 500;
font-weight: 500;
font-size: 14px;
font-size: 14px;
...
@@ -65,7 +68,6 @@ const DataLineItem = styled.div`
...
@@ -65,7 +68,6 @@ const DataLineItem = styled.div`
const
RangeLineItem
=
styled
(
DataLineItem
)
`
const
RangeLineItem
=
styled
(
DataLineItem
)
`
display: flex;
display: flex;
flex-direction: row;
flex-direction: row;
cursor: pointer;
align-items: center;
align-items: center;
justify-self: flex-end;
justify-self: flex-end;
...
@@ -199,25 +201,20 @@ export default function PositionListItem({ positionDetails }: PositionListItemPr
...
@@ -199,25 +201,20 @@ export default function PositionListItem({ positionDetails }: PositionListItemPr
},
[
liquidity
,
pool
,
tickLower
,
tickUpper
])
},
[
liquidity
,
pool
,
tickLower
,
tickUpper
])
// prices
// prices
let
{
priceLower
,
priceUpper
,
base
,
quot
e
}
=
getPriceOrderingFromPositionForUI
(
position
)
const
{
priceLower
,
priceUpper
,
quote
,
bas
e
}
=
getPriceOrderingFromPositionForUI
(
position
)
const
inverted
=
token1
?
base
?.
equals
(
token1
)
:
undefined
const
currencyQuote
=
inverted
?
currency1
:
currency0
const
currencyQuote
=
quote
&&
unwrappedToken
(
quote
)
const
currencyBase
=
inverted
?
currency0
:
currency1
const
currencyBase
=
base
&&
unwrappedToken
(
base
)
// 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/
'
+
positionDetails
.
tokenId
const
positionSummaryLink
=
'
/pool/
'
+
positionDetails
.
tokenId
const
[
manuallyInverted
,
setManuallyInverted
]
=
useState
(
true
)
if
(
manuallyInverted
)
{
;[
priceLower
,
priceUpper
,
base
,
quote
]
=
[
priceUpper
?.
invert
(),
priceLower
?.
invert
(),
quote
,
base
]
}
const
removed
=
liquidity
?.
eq
(
0
)
const
removed
=
liquidity
?.
eq
(
0
)
return
(
return
(
<
Row
to=
{
positionSummaryLink
}
>
<
Link
Row
to=
{
positionSummaryLink
}
>
<
RowFixed
>
<
RowFixed
>
<
PrimaryPositionIdData
>
<
PrimaryPositionIdData
>
<
DoubleCurrencyLogo
currency0=
{
currencyBase
}
currency1=
{
currencyQuote
}
size=
{
18
}
margin
/>
<
DoubleCurrencyLogo
currency0=
{
currencyBase
}
currency1=
{
currencyQuote
}
size=
{
18
}
margin
/>
...
@@ -233,42 +230,27 @@ export default function PositionListItem({ positionDetails }: PositionListItemPr
...
@@ -233,42 +230,27 @@ export default function PositionListItem({ positionDetails }: PositionListItemPr
</
RowFixed
>
</
RowFixed
>
{
priceLower
&&
priceUpper
?
(
{
priceLower
&&
priceUpper
?
(
<>
<
RangeLineItem
>
<
RangeLineItem
<
RangeText
>
onClick=
{
(
e
)
=>
{
<
ExtentsText
>
Min:
</
ExtentsText
>
e
.
preventDefault
()
{
formatPrice
(
priceLower
,
5
)
}
<
HoverInlineText
text=
{
currencyQuote
?.
symbol
}
/>
{
'
per
'
}{
'
'
}
e
.
stopPropagation
()
<
HoverInlineText
text=
{
currencyBase
?.
symbol
??
''
}
/>
setManuallyInverted
(
!
manuallyInverted
)
</
RangeText
>
{
'
'
}
}
}
<
HideSmall
>
>
<
DoubleArrow
>
⟷
</
DoubleArrow
>
{
'
'
}
<
RangeText
>
</
HideSmall
>
<
ExtentsText
>
Min:
</
ExtentsText
>
<
SmallOnly
>
{
formatPrice
(
priceLower
,
5
)
}{
'
'
}
<
DoubleArrow
>
↕
</
DoubleArrow
>
{
'
'
}
<
HoverInlineText
text=
{
manuallyInverted
?
currencyQuote
?.
symbol
??
''
:
currencyBase
?.
symbol
??
''
}
/>
{
'
'
}
</
SmallOnly
>
{
'
per
'
}{
'
'
}
<
RangeText
>
<
HoverInlineText
text=
{
manuallyInverted
?
currencyBase
?.
symbol
??
''
:
currencyQuote
?.
symbol
??
''
}
/>
<
ExtentsText
>
Max:
</
ExtentsText
>
</
RangeText
>
{
'
'
}
{
formatPrice
(
priceUpper
,
5
)
}
<
HoverInlineText
text=
{
currencyQuote
?.
symbol
}
/>
{
'
per
'
}{
'
'
}
<
HideSmall
>
<
HoverInlineText
maxCharacters=
{
10
}
text=
{
currencyBase
?.
symbol
}
/>
<
DoubleArrow
>
⟷
</
DoubleArrow
>
{
'
'
}
</
RangeText
>
</
HideSmall
>
</
RangeLineItem
>
<
SmallOnly
>
<
DoubleArrow
>
↕
</
DoubleArrow
>
{
'
'
}
</
SmallOnly
>
<
RangeText
>
<
ExtentsText
>
Max:
</
ExtentsText
>
{
formatPrice
(
priceUpper
,
5
)
}{
'
'
}
<
HoverInlineText
text=
{
manuallyInverted
?
currencyQuote
?.
symbol
??
''
:
currencyBase
?.
symbol
??
''
}
/>
{
'
'
}
{
'
per
'
}{
'
'
}
<
HoverInlineText
maxCharacters=
{
10
}
text=
{
manuallyInverted
?
currencyBase
?.
symbol
??
''
:
currencyQuote
?.
symbol
??
''
}
/>
</
RangeText
>
{
'
'
}
</
RangeLineItem
>
</>
)
:
(
)
:
(
<
Loader
/>
<
Loader
/>
)
}
)
}
</
Row
>
</
Link
Row
>
)
)
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment