Skip to content

Commit

Permalink
Quick fix fix
Browse files Browse the repository at this point in the history
Used the right currency and got to display signs for market percent
  • Loading branch information
Viper committed Jul 9, 2021
1 parent f75a909 commit 01ebc1e
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 15 deletions.
2 changes: 1 addition & 1 deletion 404.html
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@

<body>
<div id="app"></div>
<script src="/client.min.js?v=12.15"></script>
<script src="/client.min.js?v=12.16"></script>
</body>

</html>
2 changes: 1 addition & 1 deletion client.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,6 @@

<body>
<div id="app"></div>
<script src="/client.min.js?v=12.15"></script>
<script src="/client.min.js?v=12.16"></script>
</body>
</html>
4 changes: 2 additions & 2 deletions service-worker.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
var CACHE = "network-or-cache-v12.15";
var CACHE = "network-or-cache-v12.16";

// On install, cache some resource.
self.addEventListener("install", function(evt) {
Expand All @@ -10,7 +10,7 @@ self.addEventListener("install", function(evt) {
cache.addAll([
"/",
"/404.html",
"/client.min.js?v=12.15",
"/client.min.js?v=12.16",
"src/fonts/Cantarell-Regular.ttf",
"src/fonts/OpenSans-Regular.ttf",
"src/fonts/Saira-Regular.ttf",
Expand Down
18 changes: 9 additions & 9 deletions src/js/components/CoinChartsData.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,26 +86,26 @@ class CoinChartsData extends React.Component {
<TableRow>
<TableCell>
<span>{t("components.coin_charts_data.day")}</span>
<span className={coin_data.market_data.price_change_percentage_24h_in_currency[selected_locales_code.toLowerCase()] <= 0 ? classes.red: classes.green}>
{this._price_formatter(coin_data.market_data.price_change_percentage_24h_in_currency[selected_locales_code.toLowerCase()], "%%", selected_locales_code, 2)}
<span className={coin_data.market_data.price_change_percentage_24h_in_currency[selected_currency.toLowerCase()] <= 0 ? classes.red: classes.green}>
{this._price_formatter(coin_data.market_data.price_change_percentage_24h_in_currency[selected_currency.toLowerCase()], "%%", selected_locales_code, 2)}
</span>
</TableCell>
<TableCell>
<span>{t("components.coin_charts_data.week")}</span>
<span className={coin_data.market_data.price_change_percentage_7d_in_currency[selected_locales_code.toLowerCase()] <= 0 ? classes.red: classes.green}>
{this._price_formatter(coin_data.market_data.price_change_percentage_7d_in_currency[selected_locales_code.toLowerCase()], "%%", selected_locales_code, 2)}
<span className={coin_data.market_data.price_change_percentage_7d_in_currency[selected_currency.toLowerCase()] <= 0 ? classes.red: classes.green}>
{this._price_formatter(coin_data.market_data.price_change_percentage_7d_in_currency[selected_currency.toLowerCase()], "%%", selected_locales_code, 2)}
</span>
</TableCell>
<TableCell>
<span>{t("components.coin_charts_data.month")}</span>
<span className={coin_data.market_data.price_change_percentage_30d_in_currency[selected_locales_code.toLowerCase()] <= 0 ? classes.red: classes.green}>
{this._price_formatter(coin_data.market_data.price_change_percentage_30d_in_currency[selected_locales_code.toLowerCase()], "%%", selected_locales_code, 2)}
<span className={coin_data.market_data.price_change_percentage_30d_in_currency[selected_currency.toLowerCase()] <= 0 ? classes.red: classes.green}>
{this._price_formatter(coin_data.market_data.price_change_percentage_30d_in_currency[selected_currency.toLowerCase()], "%%", selected_locales_code, 2)}
</span>
</TableCell>
<TableCell>
<span>{t("components.coin_charts_data.year")}</span>
<span className={coin_data.market_data.price_change_percentage_1y_in_currency[selected_locales_code.toLowerCase()] <= 0 ? classes.red: classes.green}>
{this._price_formatter(coin_data.market_data.price_change_percentage_1y_in_currency[selected_locales_code.toLowerCase()], "%%", selected_locales_code, 2)}
<span className={coin_data.market_data.price_change_percentage_1y_in_currency[selected_currency.toLowerCase()] <= 0 ? classes.red: classes.green}>
{this._price_formatter(coin_data.market_data.price_change_percentage_1y_in_currency[selected_currency.toLowerCase()], "%%", selected_locales_code, 2)}
</span>
</TableCell>
</TableRow>
Expand Down Expand Up @@ -135,7 +135,7 @@ class CoinChartsData extends React.Component {
</TableRow>
<TableRow>
<TableCell align="left" className={classes.tableCellBold}>{t("components.coin_charts_data.today_score")}</TableCell>
<TableCell align="right">{coin_data.sentiment_votes_up_percentage}%</TableCell>
<TableCell align="right">{this._price_formatter(coin_data.sentiment_votes_up_percentage, "%", selected_locales_code, 0)}</TableCell>
</TableRow>
<TableRow>
<TableCell align="left" className={classes.tableCellBold}>{t("components.coin_charts_data.all_time_high")}</TableCell>
Expand Down
8 changes: 7 additions & 1 deletion src/js/utils/price-formatter.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,14 @@ function price_formatter(price = 0, _selected_currency = "usd", _selected_locale

}else {

let sign_display_props = {};

if(_selected_currency === "%%") {

sign_display_props = {
signDisplay: "exceptZero",
};

value = value > 0 ?
(value / 100) + 1:
1 - (-value / 100);
Expand All @@ -64,7 +70,7 @@ function price_formatter(price = 0, _selected_currency = "usd", _selected_locale
maximumFractionDigits: digit
};

const percentage_formatted = new Intl.NumberFormat(_selected_locales_code, {...percentage_props}).format(value);
const percentage_formatted = new Intl.NumberFormat(_selected_locales_code, {...percentage_props, ...sign_display_props}).format(value);

return percentage_formatted;
}
Expand Down

0 comments on commit 01ebc1e

Please sign in to comment.