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

scan: shorten marketcap amount on landing page #1900

Merged
merged 6 commits into from
Jun 8, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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