Open Source Wealth Management Software. Angular + NestJS + Prisma + Nx + TypeScript 🤍
TypeScript angularetffinancefintechghostfoliohacktoberfestinvestingnestjsosspersonal-financeportfolioprismasoftwarestocktrackertradingtypescriptwealth-managementweb
Feature/improve precision of values in account detail dialog on mobile (#5345)
Thomas Kaule17da1247a34
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex c15972cc27..f8560525f1 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0### Changed+- Improved the dynamic numerical precision for various values in the account detail dialog- Extended the accounts endpoint by dividend and interest## 2.190.0 - 2025-08-09diff --git a/apps/client/src/app/components/account-detail-dialog/account-detail-dialog.component.ts b/apps/client/src/app/components/account-detail-dialog/account-detail-dialog.component.tsindex 16cd468e8b..c718df6867 100644--- a/apps/client/src/app/components/account-detail-dialog/account-detail-dialog.component.ts+++ b/apps/client/src/app/components/account-detail-dialog/account-detail-dialog.component.ts@@ -2,6 +2,7 @@ import { CreateAccountBalanceDto } from '@ghostfolio/api/app/account-balance/creimport { Activity } from '@ghostfolio/api/app/order/interfaces/activities.interface';import { DataService } from '@ghostfolio/client/services/data.service';import { UserService } from '@ghostfolio/client/services/user/user.service';+import { NUMERICAL_PRECISION_THRESHOLD_6_FIGURES } from '@ghostfolio/common/config';import { DATE_FORMAT, downloadAsFile } from '@ghostfolio/common/helper';import {AccountBalancesResponse,@@ -51,9 +52,11 @@ export class AccountDetailDialog implements OnDestroy, OnInit {public accountBalances: AccountBalancesResponse['balances'];public activities: OrderWithAccount[];public balance: number;+ public balancePrecision = 2;public currency: string;public dataSource: MatTableDataSource<Activity>;public equity: number;+ public equityPrecision = 2;public hasPermissionToDeleteAccountBalance: boolean;public historicalDataItems: HistoricalDataItem[];public holdings: PortfolioPosition[];@@ -188,10 +191,25 @@ export class AccountDetailDialog implements OnDestroy, OnInit {valueInBaseCurrency}) => {this.balance = balance;++ if (+ this.balance >= NUMERICAL_PRECISION_THRESHOLD_6_FIGURES &&+ this.data.deviceType === 'mobile'+ ) {+ this.balancePrecision = 0;+ }+this.currency = currency;if (isNumber(balance) && isNumber(value)) {this.equity = new Big(value).minus(balance).toNumber();++ if (+ this.data.deviceType === 'mobile' &&+ this.equity >= NUMERICAL_PRECISION_THRESHOLD_6_FIGURES+ ) {+ this.equityPrecision = 0;+ }} else {this.equity = null;}diff --git a/apps/client/src/app/components/account-detail-dialog/account-detail-dialog.html b/apps/client/src/app/components/account-detail-dialog/account-detail-dialog.htmlindex 45d88fc788..4e86ef5ea8 100644--- a/apps/client/src/app/components/account-detail-dialog/account-detail-dialog.html+++ b/apps/client/src/app/components/account-detail-dialog/account-detail-dialog.html@@ -42,6 +42,7 @@size="medium"[isCurrency]="true"[locale]="user?.settings?.locale"+ [precision]="balancePrecision"[unit]="currency"[value]="balance">Cash Balance</gf-value@@ -53,6 +54,7 @@size="medium"[isCurrency]="true"[locale]="user?.settings?.locale"+ [precision]="equityPrecision"[unit]="currency"[value]="equity">Equity</gf-valuediff --git a/apps/client/src/app/components/holding-detail-dialog/holding-detail-dialog.component.ts b/apps/client/src/app/components/holding-detail-dialog/holding-detail-dialog.component.tsindex eb32b5f8b4..203bbb123b 100644--- a/apps/client/src/app/components/holding-detail-dialog/holding-detail-dialog.component.ts+++ b/apps/client/src/app/components/holding-detail-dialog/holding-detail-dialog.component.ts@@ -285,8 +285,8 @@ export class GfHoldingDetailDialogComponent implements OnDestroy, OnInit {this.averagePrice = averagePrice;if (- this.data.deviceType === 'mobile' &&- this.averagePrice >= NUMERICAL_PRECISION_THRESHOLD_6_FIGURES+ this.averagePrice >= NUMERICAL_PRECISION_THRESHOLD_6_FIGURES &&+ this.data.deviceType === 'mobile') {this.averagePricePrecision = 0;}