diff --git a/CHANGELOG.md b/CHANGELOG.md index 297677b966..1976fabf8c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed +- Extended the account detail dialog to include the change and the performance - Improved the market price in the benchmark detail dialog by adding the currency and reducing the precision on mobile - Improved the style of the close button in the dialog footer component - Improved the style of the close button in the dialog header component diff --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.ts index f6fe52a8bd..8dcae8a65e 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 { UserService } from '@ghostfolio/client/services/user/user.service'; import { DEFAULT_DATE_RANGE, DEFAULT_PAGE_SIZE, + NUMERICAL_PRECISION_THRESHOLD_3_FIGURES, NUMERICAL_PRECISION_THRESHOLD_4_FIGURES } from '@ghostfolio/common/config'; import { CreateAccountBalanceDto } from '@ghostfolio/common/dtos'; @@ -104,6 +105,10 @@ export class GfAccountDetailDialogComponent implements OnInit { protected isLoading = true; protected isLoadingChart: boolean; protected name: string | null; + protected netPerformancePercentageWithCurrencyEffect: number; + protected netPerformancePercentageWithCurrencyEffectPrecision = 2; + protected netPerformanceWithCurrencyEffect: number; + protected netPerformanceWithCurrencyEffectPrecision = 2; protected pageIndex = 0; protected pageSize = DEFAULT_PAGE_SIZE; protected platformName: string; @@ -358,6 +363,33 @@ export class GfAccountDetailDialogComponent implements OnInit { next: ({ accountBalances, portfolioPerformance }) => { this.accountBalances = accountBalances.balances; + const { + netPerformancePercentageWithCurrencyEffect, + netPerformanceWithCurrencyEffect + } = portfolioPerformance.performance; + + this.netPerformancePercentageWithCurrencyEffect = + netPerformancePercentageWithCurrencyEffect; + + if ( + this.data.deviceType === 'mobile' && + this.netPerformancePercentageWithCurrencyEffect >= + NUMERICAL_PRECISION_THRESHOLD_3_FIGURES + ) { + this.netPerformancePercentageWithCurrencyEffectPrecision = 0; + } + + this.netPerformanceWithCurrencyEffect = + netPerformanceWithCurrencyEffect; + + if ( + this.data.deviceType === 'mobile' && + this.netPerformanceWithCurrencyEffect >= + NUMERICAL_PRECISION_THRESHOLD_4_FIGURES + ) { + this.netPerformanceWithCurrencyEffectPrecision = 0; + } + if ( portfolioPerformance.chart && portfolioPerformance.chart.length > 0 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.html index e4ef8fe55f..5bd3c745ad 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 @@ -45,6 +45,35 @@