Skip to content
This repository has been archived by the owner on Nov 16, 2022. It is now read-only.

Commit

Permalink
Merge pull request #1900 from bandprotocol/1853-shorten-marketcap
Browse files Browse the repository at this point in the history
  • Loading branch information
Sawit Trisirisatayawong authored Jun 8, 2020
2 parents 1bf9aa3 + b81e6b0 commit a7263b5
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

### Scan

- (imprv) [\#1900](https://github.com/bandprotocol/bandchain/pull/1900) Shorten marketcap amount on landing page
- (bug) [\#1861](https://github.com/bandprotocol/bandchain/pull/1861) Fix name, endpoint of guanyu-devnet on chain-id selection

### Bridges
Expand Down
7 changes: 3 additions & 4 deletions scan/src/components/ChainInfoHighlights.re
Original file line number Diff line number Diff line change
Expand Up @@ -134,22 +134,21 @@ let make = (~latestBlockSub: Sub.t(BlockSub.t)) => {
let%Sub (_, {financial}, _) = allSub;
(
{
let marketcap = "$" ++ financial.usdMarketCap->Format.fPretty;
<Text
value=marketcap
value={financial.usdMarketCap |> Format.fCurrency}
size=Text.Xxxl
weight=Text.Semibold
color=Colors.gray8
code=true
/>;
},
{
let marketcap = financial.circulatingSupply;
let marketcap = financial.btcMarketCap;
<div className={Styles.withWidth(170)}>
<div className=Styles.vFlex>
<Text value={marketcap->Format.fPretty} code=true weight=Text.Thin />
<HSpacing size=Spacing.xs />
<Text value="BAND" color=Colors.gray7 weight=Text.Thin spacing={Text.Em(0.01)} />
<Text value="BTC" color=Colors.gray7 weight=Text.Thin spacing={Text.Em(0.01)} />
</div>
</div>;
},
Expand Down
11 changes: 11 additions & 0 deletions scan/src/utils/Format.re
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,17 @@ let fPretty = (~digits=?, value) => {
};
};

let fCurrency = value =>
if (value >= 1e9) {
"$" ++ (value /. 1e9 |> fPretty(~digits=2)) ++ "B";
} else if (value >= 1e6) {
"$" ++ (value /. 1e6 |> fPretty(~digits=2)) ++ "M";
} else if (value >= 1e3) {
"$" ++ (value /. 1e3 |> fPretty(~digits=2)) ++ "K";
} else {
"$" ++ (value |> fPretty(~digits=2));
};

let fPercentChange = value =>
(value > 0. ? "+" : "") ++ value->Js.Float.toFixedWithPrecision(~digits=2) ++ "%";

Expand Down

0 comments on commit a7263b5

Please sign in to comment.