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
d8eb4d18
Unverified
Commit
d8eb4d18
authored
Sep 28, 2022
by
cartcrom
Committed by
GitHub
Sep 28, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: display 0 percent change on explore (#4747)
* fixed issue
parent
25d64911
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
9 deletions
+13
-9
PriceChart.tsx
src/components/Tokens/TokenDetails/PriceChart.tsx
+10
-6
TokenRow.tsx
src/components/Tokens/TokenTable/TokenRow.tsx
+3
-3
No files found.
src/components/Tokens/TokenDetails/PriceChart.tsx
View file @
d8eb4d18
...
...
@@ -56,17 +56,21 @@ export function calculateDelta(start: number, current: number) {
return
(
current
/
start
-
1
)
*
100
}
export
function
getDeltaArrow
(
delta
:
number
)
{
if
(
Math
.
sign
(
delta
)
>
0
)
{
return
<
StyledUpArrow
size=
{
16
}
key=
"arrow-up"
/>
}
else
if
(
delta
===
0
)
{
export
function
getDeltaArrow
(
delta
:
number
|
null
|
undefined
)
{
// Null-check not including zero
if
(
delta
===
null
||
delta
===
undefined
)
{
return
null
}
else
{
}
else
if
(
Math
.
sign
(
delta
)
<
0
)
{
return
<
StyledDownArrow
size=
{
16
}
key=
"arrow-down"
/>
}
return
<
StyledUpArrow
size=
{
16
}
key=
"arrow-up"
/>
}
export
function
formatDelta
(
delta
:
number
)
{
export
function
formatDelta
(
delta
:
number
|
null
|
undefined
)
{
// Null-check not including zero
if
(
delta
===
null
||
delta
===
undefined
)
{
return
'
-
'
}
let
formattedDelta
=
delta
.
toFixed
(
2
)
+
'
%
'
if
(
Math
.
sign
(
delta
)
>
0
)
{
formattedDelta
=
'
+
'
+
formattedDelta
...
...
src/components/Tokens/TokenTable/TokenRow.tsx
View file @
d8eb4d18
...
...
@@ -485,8 +485,8 @@ export const LoadedRow = forwardRef((props: LoadedRowProps, ref: ForwardedRef<HT
const
L2Icon
=
getChainInfo
(
CHAIN_NAME_TO_CHAIN_ID
[
filterNetwork
]).
circleLogoUrl
const
timePeriod
=
useAtomValue
(
filterTimeAtom
)
const
delta
=
token
.
market
?.
pricePercentChange
?.
value
const
arrow
=
delta
?
getDeltaArrow
(
delta
)
:
null
const
formattedDelta
=
delta
?
formatDelta
(
delta
)
:
null
const
arrow
=
getDeltaArrow
(
delta
)
const
formattedDelta
=
formatDelta
(
delta
)
const
sortAscending
=
useAtomValue
(
sortAscendingAtom
)
const
exploreTokenSelectedEventProperties
=
{
...
...
@@ -544,7 +544,7 @@ export const LoadedRow = forwardRef((props: LoadedRowProps, ref: ForwardedRef<HT
}
percentChange=
{
<
ClickableContent
>
{
formattedDelta
??
'
-
'
}
{
formattedDelta
}
{
arrow
}
</
ClickableContent
>
}
...
...
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