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
813aeda0
Unverified
Commit
813aeda0
authored
Mar 14, 2023
by
Vignesh Mohankumar
Committed by
GitHub
Mar 14, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: use tx formatting for PositionPage cards (#6142)
* tooltip * add numberType * try again * eslint * one more
parent
13d3e75a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
4 deletions
+8
-4
PositionPage.tsx
src/pages/Pool/PositionPage.tsx
+5
-2
formatTickPrice.ts
src/utils/formatTickPrice.ts
+3
-2
No files found.
src/pages/Pool/PositionPage.tsx
View file @
813aeda0
...
@@ -3,6 +3,7 @@ import type { TransactionResponse } from '@ethersproject/providers'
...
@@ -3,6 +3,7 @@ import type { TransactionResponse } from '@ethersproject/providers'
import
{
Trans
}
from
'
@lingui/macro
'
import
{
Trans
}
from
'
@lingui/macro
'
import
{
Trace
}
from
'
@uniswap/analytics
'
import
{
Trace
}
from
'
@uniswap/analytics
'
import
{
InterfacePageName
}
from
'
@uniswap/analytics-events
'
import
{
InterfacePageName
}
from
'
@uniswap/analytics-events
'
import
{
formatPrice
,
NumberType
}
from
'
@uniswap/conedison/format
'
import
{
Currency
,
CurrencyAmount
,
Fraction
,
Percent
,
Price
,
Token
}
from
'
@uniswap/sdk-core
'
import
{
Currency
,
CurrencyAmount
,
Fraction
,
Percent
,
Price
,
Token
}
from
'
@uniswap/sdk-core
'
import
{
NonfungiblePositionManager
,
Pool
,
Position
}
from
'
@uniswap/v3-sdk
'
import
{
NonfungiblePositionManager
,
Pool
,
Position
}
from
'
@uniswap/v3-sdk
'
import
{
useWeb3React
}
from
'
@web3-react/core
'
import
{
useWeb3React
}
from
'
@web3-react/core
'
...
@@ -172,13 +173,13 @@ function CurrentPriceCard({
...
@@ -172,13 +173,13 @@ function CurrentPriceCard({
}
}
return
(
return
(
<
LightCard
padding=
"12px
"
>
<
LightCard
padding=
"12px"
>
<
AutoColumn
gap=
"sm"
justify=
"center"
>
<
AutoColumn
gap=
"sm"
justify=
"center"
>
<
ExtentsText
>
<
ExtentsText
>
<
Trans
>
Current price
</
Trans
>
<
Trans
>
Current price
</
Trans
>
</
ExtentsText
>
</
ExtentsText
>
<
ThemedText
.
DeprecatedMediumHeader
textAlign=
"center"
>
<
ThemedText
.
DeprecatedMediumHeader
textAlign=
"center"
>
{
(
inverted
?
pool
.
token1Price
:
pool
.
token0Price
).
toSignificant
(
6
)
}{
'
'
}
{
formatPrice
(
inverted
?
pool
.
token1Price
:
pool
.
token0Price
,
NumberType
.
TokenTx
)
}
</
ThemedText
.
DeprecatedMediumHeader
>
</
ThemedText
.
DeprecatedMediumHeader
>
<
ExtentsText
>
<
ExtentsText
>
<
Trans
>
<
Trans
>
...
@@ -889,6 +890,7 @@ export function PositionPage() {
...
@@ -889,6 +890,7 @@ export function PositionPage() {
price
:
priceLower
,
price
:
priceLower
,
atLimit
:
tickAtLimit
,
atLimit
:
tickAtLimit
,
direction
:
Bound
.
LOWER
,
direction
:
Bound
.
LOWER
,
numberType
:
NumberType
.
TokenTx
,
})
}
})
}
</
ThemedText
.
DeprecatedMediumHeader
>
</
ThemedText
.
DeprecatedMediumHeader
>
<
ExtentsText
>
<
ExtentsText
>
...
@@ -917,6 +919,7 @@ export function PositionPage() {
...
@@ -917,6 +919,7 @@ export function PositionPage() {
price
:
priceUpper
,
price
:
priceUpper
,
atLimit
:
tickAtLimit
,
atLimit
:
tickAtLimit
,
direction
:
Bound
.
UPPER
,
direction
:
Bound
.
UPPER
,
numberType
:
NumberType
.
TokenTx
,
})
}
})
}
</
ThemedText
.
DeprecatedMediumHeader
>
</
ThemedText
.
DeprecatedMediumHeader
>
<
ExtentsText
>
<
ExtentsText
>
...
...
src/utils/formatTickPrice.ts
View file @
813aeda0
...
@@ -8,9 +8,10 @@ interface FormatTickPriceArgs {
...
@@ -8,9 +8,10 @@ interface FormatTickPriceArgs {
atLimit
:
{
[
bound
in
Bound
]?:
boolean
|
undefined
}
atLimit
:
{
[
bound
in
Bound
]?:
boolean
|
undefined
}
direction
:
Bound
direction
:
Bound
placeholder
?:
string
placeholder
?:
string
numberType
?:
NumberType
}
}
export
function
formatTickPrice
({
price
,
atLimit
,
direction
,
placeholder
}:
FormatTickPriceArgs
)
{
export
function
formatTickPrice
({
price
,
atLimit
,
direction
,
placeholder
,
numberType
}:
FormatTickPriceArgs
)
{
if
(
atLimit
[
direction
])
{
if
(
atLimit
[
direction
])
{
return
direction
===
Bound
.
LOWER
?
'
0
'
:
'
∞
'
return
direction
===
Bound
.
LOWER
?
'
0
'
:
'
∞
'
}
}
...
@@ -19,5 +20,5 @@ export function formatTickPrice({ price, atLimit, direction, placeholder }: Form
...
@@ -19,5 +20,5 @@ export function formatTickPrice({ price, atLimit, direction, placeholder }: Form
return
placeholder
return
placeholder
}
}
return
formatPrice
(
price
,
NumberType
.
TokenNonTx
)
return
formatPrice
(
price
,
numberType
??
NumberType
.
TokenNonTx
)
}
}
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