From f4e787755a041e4e522d380d3e6913fba5725f03 Mon Sep 17 00:00:00 2001 From: yuriy0803 <68668177+yuriy0803@users.noreply.github.com> Date: Mon, 20 Nov 2023 18:58:56 +0100 Subject: [PATCH] Your Threshold info Your Threshold info --- api/server.go | 1 + www/app/helpers/format-threshold.js | 11 +++++++++++ www/app/templates/account.hbs | 6 ++++-- 3 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 www/app/helpers/format-threshold.js diff --git a/api/server.go b/api/server.go index 2eef8cb..9324b7b 100644 --- a/api/server.go +++ b/api/server.go @@ -462,6 +462,7 @@ func (s *ApiServer) AccountIndex(w http.ResponseWriter, r *http.Request) { stats["minerCharts"], err = s.backend.GetMinerCharts(s.config.MinerChartsNum, login) stats["shareCharts"], err = s.backend.GetShareCharts(s.config.ShareChartsNum, login) stats["paymentCharts"], err = s.backend.GetPaymentCharts(login) + stats["threshold"], err = s.backend.GetThreshold(login) reply = &Entry{stats: stats, updatedAt: now} s.miners[login] = reply } diff --git a/www/app/helpers/format-threshold.js b/www/app/helpers/format-threshold.js new file mode 100644 index 0000000..7fd409b --- /dev/null +++ b/www/app/helpers/format-threshold.js @@ -0,0 +1,11 @@ +import { helper as buildHelper } from '@ember/component/helper'; + +export function formatBalance(value) { + if (value < 0) { + value = 0; + } + value = value * 0.000000001; + return value.toFixed(2); // Change toFixed(1) to toFixed(2) +} + +export default buildHelper(formatBalance); diff --git a/www/app/templates/account.hbs b/www/app/templates/account.hbs index 75b2b46..19ebf75 100644 --- a/www/app/templates/account.hbs +++ b/www/app/templates/account.hbs @@ -9,6 +9,8 @@
Pending Balance: {{format-balance model.stats.balance}}
+ Your Threshold: {{format-threshold model.threshold}} + {{config.Unit}}
Credited coins awaiting payout.
{{#if model.stats.pending}} @@ -73,9 +75,9 @@ {{#link-to 'account.payouts'}}Payouts{{/link-to}} {{/active-li}} {{#active-li currentWhen='account.settings' role='presentation'}} - {{#link-to 'account.settings'}}Settings{{/link-to}} + {{#link-to 'account.settings'}}Settings{{/link-to}} {{/active-li}} -{{outlet}} +{{outlet}} \ No newline at end of file