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
Hide 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) {
...
@@ -56,17 +56,21 @@ export function calculateDelta(start: number, current: number) {
return
(
current
/
start
-
1
)
*
100
return
(
current
/
start
-
1
)
*
100
}
}
export
function
getDeltaArrow
(
delta
:
number
)
{
export
function
getDeltaArrow
(
delta
:
number
|
null
|
undefined
)
{
if
(
Math
.
sign
(
delta
)
>
0
)
{
// Null-check not including zero
return
<
StyledUpArrow
size=
{
16
}
key=
"arrow-up"
/>
if
(
delta
===
null
||
delta
===
undefined
)
{
}
else
if
(
delta
===
0
)
{
return
null
return
null
}
else
{
}
else
if
(
Math
.
sign
(
delta
)
<
0
)
{
return
<
StyledDownArrow
size=
{
16
}
key=
"arrow-down"
/>
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
)
+
'
%
'
let
formattedDelta
=
delta
.
toFixed
(
2
)
+
'
%
'
if
(
Math
.
sign
(
delta
)
>
0
)
{
if
(
Math
.
sign
(
delta
)
>
0
)
{
formattedDelta
=
'
+
'
+
formattedDelta
formattedDelta
=
'
+
'
+
formattedDelta
...
...
src/components/Tokens/TokenTable/TokenRow.tsx
View file @
d8eb4d18
...
@@ -485,8 +485,8 @@ export const LoadedRow = forwardRef((props: LoadedRowProps, ref: ForwardedRef<HT
...
@@ -485,8 +485,8 @@ export const LoadedRow = forwardRef((props: LoadedRowProps, ref: ForwardedRef<HT
const
L2Icon
=
getChainInfo
(
CHAIN_NAME_TO_CHAIN_ID
[
filterNetwork
]).
circleLogoUrl
const
L2Icon
=
getChainInfo
(
CHAIN_NAME_TO_CHAIN_ID
[
filterNetwork
]).
circleLogoUrl
const
timePeriod
=
useAtomValue
(
filterTimeAtom
)
const
timePeriod
=
useAtomValue
(
filterTimeAtom
)
const
delta
=
token
.
market
?.
pricePercentChange
?.
value
const
delta
=
token
.
market
?.
pricePercentChange
?.
value
const
arrow
=
delta
?
getDeltaArrow
(
delta
)
:
null
const
arrow
=
getDeltaArrow
(
delta
)
const
formattedDelta
=
delta
?
formatDelta
(
delta
)
:
null
const
formattedDelta
=
formatDelta
(
delta
)
const
sortAscending
=
useAtomValue
(
sortAscendingAtom
)
const
sortAscending
=
useAtomValue
(
sortAscendingAtom
)
const
exploreTokenSelectedEventProperties
=
{
const
exploreTokenSelectedEventProperties
=
{
...
@@ -544,7 +544,7 @@ export const LoadedRow = forwardRef((props: LoadedRowProps, ref: ForwardedRef<HT
...
@@ -544,7 +544,7 @@ export const LoadedRow = forwardRef((props: LoadedRowProps, ref: ForwardedRef<HT
}
}
percentChange=
{
percentChange=
{
<
ClickableContent
>
<
ClickableContent
>
{
formattedDelta
??
'
-
'
}
{
formattedDelta
}
{
arrow
}
{
arrow
}
</
ClickableContent
>
</
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