Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
frontend
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
vicotor
frontend
Commits
1da4e469
Commit
1da4e469
authored
Nov 11, 2022
by
tom
Committed by
isstuev
Nov 16, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
amounts formatter
parent
a05aff1b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
1 deletion
+26
-1
formatters.ts
lib/formatters.ts
+24
-0
indicators.tsx
ui/home/indicators/utils/indicators.tsx
+2
-1
No files found.
lib/formatters.ts
0 → 100644
View file @
1da4e469
export
function
shortenNumberWithLetter
(
x
:
number
,
params
?:
{
unitSeparator
:
string
;
},
_options
?:
Intl
.
NumberFormatOptions
,
)
{
const
options
=
_options
||
{
maximumFractionDigits
:
2
};
const
unitSeparator
=
params
?.
unitSeparator
||
''
;
if
(
x
>
1
_000_000_000
)
{
return
(
x
/
1
_000_000_000
).
toLocaleString
(
'
en
'
,
options
)
+
unitSeparator
+
'
B
'
;
}
if
(
x
>
1
_000_000
)
{
return
(
x
/
1
_000_000
).
toLocaleString
(
'
en
'
,
options
)
+
unitSeparator
+
'
M
'
;
}
if
(
x
>
1
_000
)
{
return
(
x
/
1
_000
).
toLocaleString
(
'
en
'
,
options
)
+
unitSeparator
+
'
K
'
;
}
return
x
.
toLocaleString
(
'
en
'
,
options
);
}
ui/home/indicators/utils/indicators.tsx
View file @
1da4e469
...
...
@@ -7,6 +7,7 @@ import { QueryKeys } from 'types/client/queries';
import
appConfig
from
'
configs/app/config
'
;
import
globeIcon
from
'
icons/globe.svg
'
;
import
txIcon
from
'
icons/transactions.svg
'
;
import
{
shortenNumberWithLetter
}
from
'
lib/formatters
'
;
import
{
sortByDateDesc
}
from
'
ui/shared/chart/utils/sorts
'
;
const
COLOR
=
'
#439AE2
'
;
...
...
@@ -25,7 +26,7 @@ const dailyTxsIndicator: TChainIndicator<QueryKeys.chartsTxs> = {
.
sort
(
sortByDateDesc
),
name
:
'
Tx/day
'
,
color
:
COLOR
,
valueFormatter
:
(
x
)
=>
x
.
toString
(
),
valueFormatter
:
(
x
)
=>
'
$
'
+
shortenNumberWithLetter
(
x
),
}
]),
},
};
...
...
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