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
6520dd33
Unverified
Commit
6520dd33
authored
Nov 16, 2022
by
Mike Grabowski
Committed by
GitHub
Nov 16, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: limit max volume change value to 9999% (#5227)
* fix web-2246 * chore: change to > * chore: use single component
parent
c479239a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
3 deletions
+11
-3
Cells.tsx
src/nft/components/explore/Cells/Cells.tsx
+5
-2
CollectionTable.tsx
src/nft/components/explore/CollectionTable.tsx
+6
-1
No files found.
src/nft/components/explore/Cells/Cells.tsx
View file @
6520dd33
...
@@ -3,6 +3,7 @@ import { SquareArrowDownIcon, SquareArrowUpIcon, VerifiedIcon } from 'nft/compon
...
@@ -3,6 +3,7 @@ import { SquareArrowDownIcon, SquareArrowUpIcon, VerifiedIcon } from 'nft/compon
import
{
useIsMobile
}
from
'
nft/hooks
'
import
{
useIsMobile
}
from
'
nft/hooks
'
import
{
Denomination
}
from
'
nft/types
'
import
{
Denomination
}
from
'
nft/types
'
import
{
volumeFormatter
}
from
'
nft/utils
'
import
{
volumeFormatter
}
from
'
nft/utils
'
import
{
ReactNode
}
from
'
react
'
import
styled
from
'
styled-components/macro
'
import
styled
from
'
styled-components/macro
'
import
{
ThemedText
}
from
'
theme
'
import
{
ThemedText
}
from
'
theme
'
...
@@ -155,14 +156,16 @@ export const VolumeCell = ({
...
@@ -155,14 +156,16 @@ export const VolumeCell = ({
)
)
}
}
export
const
ChangeCell
=
({
change
}:
{
change
?:
number
})
=>
(
export
const
ChangeCell
=
({
change
,
children
}:
{
children
?:
ReactNode
;
change
?:
number
})
=>
(
<
ChangeCellContainer
change=
{
change
??
0
}
>
<
ChangeCellContainer
change=
{
change
??
0
}
>
{
!
change
||
change
>
0
?
(
{
!
change
||
change
>
0
?
(
<
SquareArrowUpIcon
width=
"20px"
height=
"20px"
/>
<
SquareArrowUpIcon
width=
"20px"
height=
"20px"
/>
)
:
(
)
:
(
<
SquareArrowDownIcon
width=
"20px"
height=
"20px"
/>
<
SquareArrowDownIcon
width=
"20px"
height=
"20px"
/>
)
}
)
}
<
ThemedText
.
BodyPrimary
color=
"currentColor"
>
{
change
?
Math
.
abs
(
Math
.
round
(
change
))
:
0
}
%
</
ThemedText
.
BodyPrimary
>
<
ThemedText
.
BodyPrimary
color=
"currentColor"
>
{
children
||
`${change ? Math.abs(Math.round(change)) : 0}%`
}
</
ThemedText
.
BodyPrimary
>
</
ChangeCellContainer
>
</
ChangeCellContainer
>
)
)
...
...
src/nft/components/explore/CollectionTable.tsx
View file @
6520dd33
...
@@ -16,6 +16,8 @@ export enum ColumnHeaders {
...
@@ -16,6 +16,8 @@ export enum ColumnHeaders {
Owners
=
'
Owners
'
,
Owners
=
'
Owners
'
,
}
}
const
VOLUME_CHANGE_MAX_VALUE
=
9999
const
compareFloats
=
(
a
:
number
,
b
:
number
):
1
|
-
1
=>
{
const
compareFloats
=
(
a
:
number
,
b
:
number
):
1
|
-
1
=>
{
return
Math
.
round
(
a
*
100000
)
>=
Math
.
round
(
b
*
100000
)
?
1
:
-
1
return
Math
.
round
(
a
*
100000
)
>=
Math
.
round
(
b
*
100000
)
?
1
:
-
1
}
}
...
@@ -110,10 +112,13 @@ const CollectionTable = ({ data, timePeriod }: { data: CollectionTableColumn[];
...
@@ -110,10 +112,13 @@ const CollectionTable = ({ data, timePeriod }: { data: CollectionTableColumn[];
disableSortBy
:
timePeriod
===
TimePeriod
.
AllTime
,
disableSortBy
:
timePeriod
===
TimePeriod
.
AllTime
,
sortType
:
volumeChangeSort
,
sortType
:
volumeChangeSort
,
Cell
:
function
changeCell
(
cell
:
CellProps
<
CollectionTableColumn
>
)
{
Cell
:
function
changeCell
(
cell
:
CellProps
<
CollectionTableColumn
>
)
{
const
{
change
}
=
cell
.
row
.
original
.
volume
return
timePeriod
===
TimePeriod
.
AllTime
?
(
return
timePeriod
===
TimePeriod
.
AllTime
?
(
<
TextCell
value=
"-"
/>
<
TextCell
value=
"-"
/>
)
:
change
>=
VOLUME_CHANGE_MAX_VALUE
?
(
<
ChangeCell
change=
{
change
}
>
{
`>${VOLUME_CHANGE_MAX_VALUE}`
}
%
</
ChangeCell
>
)
:
(
)
:
(
<
ChangeCell
change=
{
c
ell
.
row
.
original
.
volume
.
c
hange
}
/>
<
ChangeCell
change=
{
change
}
/>
)
)
},
},
},
},
...
...
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