Browse Source

Update summary page

pull/5027/head
Dan 3 months ago
parent
commit
4169391c40
  1. 12
      apps/client/src/app/components/portfolio-summary/portfolio-summary.component.html
  2. 22
      apps/client/src/app/components/portfolio-summary/portfolio-summary.component.ts

12
apps/client/src/app/components/portfolio-summary/portfolio-summary.component.html

@ -115,11 +115,13 @@
<div class="flex-nowrap px-3 py-1 row"> <div class="flex-nowrap px-3 py-1 row">
<div class="flex-grow-1 text-truncate ml-3"> <div class="flex-grow-1 text-truncate ml-3">
<ng-container i18n>Net Performance</ng-container> <ng-container i18n>Net Performance</ng-container>
<abbr <ng-container *ngIf="this.calculationType">
class="initialism ml-2 text-muted" <abbr
title="Return on Average Investment" class="initialism ml-2 text-muted"
>(ROAI)</abbr title="{{ this.calculationType.title }}"
> >({{ this.calculationType.value }})</abbr
>
</ng-container>
</div> </div>
<div class="flex-column flex-wrap justify-content-end"> <div class="flex-column flex-wrap justify-content-end">
<gf-value <gf-value

22
apps/client/src/app/components/portfolio-summary/portfolio-summary.component.ts

@ -1,6 +1,7 @@
import { NotificationService } from '@ghostfolio/client/core/notification/notification.service'; import { NotificationService } from '@ghostfolio/client/core/notification/notification.service';
import { getDateFnsLocale, getLocale } from '@ghostfolio/common/helper'; import { getDateFnsLocale, getLocale } from '@ghostfolio/common/helper';
import { PortfolioSummary, User } from '@ghostfolio/common/interfaces'; import { PortfolioSummary, User } from '@ghostfolio/common/interfaces';
import { PerformanceCalculationType } from '@ghostfolio/common/types/performance-calculation-type.type';
import { translate } from '@ghostfolio/ui/i18n'; import { translate } from '@ghostfolio/ui/i18n';
import { import {
@ -36,6 +37,8 @@ export class PortfolioSummaryComponent implements OnChanges {
); );
public timeInMarket: string; public timeInMarket: string;
protected calculationType: { title: string; value: string };
public constructor(private notificationService: NotificationService) {} public constructor(private notificationService: NotificationService) {}
public ngOnChanges() { public ngOnChanges() {
@ -50,6 +53,7 @@ export class PortfolioSummaryComponent implements OnChanges {
} else { } else {
this.timeInMarket = undefined; this.timeInMarket = undefined;
} }
this.calculationType = this.getCalulationType();
} }
public onEditEmergencyFund() { public onEditEmergencyFund() {
@ -64,4 +68,22 @@ export class PortfolioSummaryComponent implements OnChanges {
title: $localize`Please set the amount of your emergency fund.` title: $localize`Please set the amount of your emergency fund.`
}); });
} }
private getCalulationType(): { title: string; value: string } {
switch (this.user?.settings?.performanceCalculationType) {
case PerformanceCalculationType.ROAI:
return {
title: 'Return on Average Investment',
value: PerformanceCalculationType.ROAI
};
case PerformanceCalculationType.ROI:
return {
title: 'Return on Investment',
value: PerformanceCalculationType.ROI
};
default:
return undefined;
}
}
} }

Loading…
Cancel
Save