mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2025-02-22 06:21:44 +01:00
Dashboard: Fix SATS denomination display (#4994)
When the default currency of the store is SATS, the display was broken.
This commit is contained in:
parent
a918288e3b
commit
55203e0b64
2 changed files with 5 additions and 4 deletions
|
@ -92,8 +92,7 @@
|
|||
window.setTimeout(() => {
|
||||
const yLabels = [...document.querySelectorAll('.ct-label.ct-vertical.ct-start')];
|
||||
if (yLabels) {
|
||||
const factor = rate ? 6 : 8;
|
||||
const width = Math.max(...(yLabels.map(l => l.innerText.length * factor)));
|
||||
const width = Math.max(...(yLabels.map(l => l.innerText.length * 7.5)));
|
||||
const opts = Object.assign({}, renderOpts, {
|
||||
axisY: Object.assign({}, renderOpts.axisY, { offset: width })
|
||||
});
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
@using BTCPayServer.Components.AppSales
|
||||
@using BTCPayServer.Components.AppTopItems
|
||||
@using BTCPayServer.Services.Apps
|
||||
@inject AppService AppService
|
||||
@model StoreDashboardViewModel
|
||||
@{
|
||||
ViewData.SetActivePage(StoreNavPages.Dashboard, Model.StoreName, Model.StoreId);
|
||||
|
@ -63,8 +62,11 @@
|
|||
displayDefaultCurrency(amount, rate, currency, divisibility) {
|
||||
const value = DashboardUtils.toDefaultCurrency(amount, rate);
|
||||
const locale = currency === 'USD' ? 'en-US' : navigator.language;
|
||||
const isSats = currency === 'SATS';
|
||||
if (isSats) currency = 'BTC';
|
||||
const opts = { currency, style: 'decimal', minimumFractionDigits: divisibility };
|
||||
return new Intl.NumberFormat(locale, opts).format(value);
|
||||
const val = new Intl.NumberFormat(locale, opts).format(value);
|
||||
return isSats ? val.replace(/[\\.,]/g, ' ') : val;
|
||||
},
|
||||
async fetchRate(currencyPair) {
|
||||
const storeId = @Safe.Json(Context.GetRouteValue("storeId"));
|
||||
|
|
Loading…
Add table
Reference in a new issue