Skip to content

Open Source Wealth Management Software. Angular + NestJS + Prisma + Nx + TypeScript 🤍

Feature/improve portfolio summary (#3472)

Thomas Kaul00e50c6abec9
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 6e1df748b6..60f0fd3ab2 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 portfolio summary
- Improved the allocations by ETF holding on the allocations page (experimental)
- Improved the error handling in the `HttpResponseInterceptor`
- Improved the language localization for German (`de`)
diff --git a/apps/client/src/app/components/home-summary/home-summary.component.ts b/apps/client/src/app/components/home-summary/home-summary.component.ts
index b67b67ce50..861d702b6f 100644
--- a/apps/client/src/app/components/home-summary/home-summary.component.ts
+++ b/apps/client/src/app/components/home-summary/home-summary.component.ts
@@ -9,12 +9,7 @@ import {
import { hasPermission, permissions } from '@ghostfolio/common/permissions';
import { ChangeDetectorRef, Component, OnDestroy, OnInit } from '@angular/core';
-import {
- MatSnackBar,
- MatSnackBarRef,
- TextOnlySnackBar
-} from '@angular/material/snack-bar';
-import { Router } from '@angular/router';
+import { MatSnackBarRef, TextOnlySnackBar } from '@angular/material/snack-bar';
import { Subject } from 'rxjs';
import { takeUntil } from 'rxjs/operators';
@@ -39,8 +34,6 @@ export class HomeSummaryComponent implements OnDestroy, OnInit {
private changeDetectorRef: ChangeDetectorRef,
private dataService: DataService,
private impersonationStorageService: ImpersonationStorageService,
- private router: Router,
- private snackBar: MatSnackBar,
private userService: UserService
) {
this.info = this.dataService.fetchInfo();
@@ -108,24 +101,6 @@ export class HomeSummaryComponent implements OnDestroy, OnInit {
this.summary = summary;
this.isLoading = false;
- if (!this.summary) {
- this.snackBarRef = this.snackBar.open(
- $localize`This feature requires a subscription.`,
- this.hasPermissionForSubscription
- ? $localize`Upgrade Plan`
- : undefined,
- { duration: 6000 }
- );
-
- this.snackBarRef.afterDismissed().subscribe(() => {
- this.snackBarRef = undefined;
- });
-
- this.snackBarRef.onAction().subscribe(() => {
- this.router.navigate(['/' + $localize`pricing`]);
- });
- }
-
this.changeDetectorRef.markForCheck();
});
diff --git a/apps/client/src/app/components/home-summary/home-summary.html b/apps/client/src/app/components/home-summary/home-summary.html
index c00fb57702..9434f7018a 100644
--- a/apps/client/src/app/components/home-summary/home-summary.html
+++ b/apps/client/src/app/components/home-summary/home-summary.html
@@ -13,6 +13,7 @@
[language]="user?.settings?.language"
[locale]="user?.settings?.locale"
[summary]="summary"
+ [user]="user"
(emergencyFundChanged)="onChangeEmergencyFund($event)"
/>
</mat-card-content>
diff --git a/apps/client/src/app/components/home-summary/home-summary.module.ts b/apps/client/src/app/components/home-summary/home-summary.module.ts
index 75cea99629..2176d0aa74 100644
--- a/apps/client/src/app/components/home-summary/home-summary.module.ts
+++ b/apps/client/src/app/components/home-summary/home-summary.module.ts
@@ -3,18 +3,12 @@ import { GfPortfolioSummaryModule } from '@ghostfolio/client/components/portfoli
import { CommonModule } from '@angular/common';
import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core';
import { MatCardModule } from '@angular/material/card';
-import { RouterModule } from '@angular/router';
import { HomeSummaryComponent } from './home-summary.component';
@NgModule({
declarations: [HomeSummaryComponent],
- imports: [
- CommonModule,
- GfPortfolioSummaryModule,
- MatCardModule,
- RouterModule
- ],
+ imports: [CommonModule, GfPortfolioSummaryModule, MatCardModule],
schemas: [CUSTOM_ELEMENTS_SCHEMA]
})
export class GfHomeSummaryModule {}
diff --git a/apps/client/src/app/components/portfolio-summary/portfolio-summary.component.html b/apps/client/src/app/components/portfolio-summary/portfolio-summary.component.html
index 6b80e87b6d..8f7fb470d7 100644
--- a/apps/client/src/app/components/portfolio-summary/portfolio-summary.component.html
+++ b/apps/client/src/app/components/portfolio-summary/portfolio-summary.component.html
@@ -107,7 +107,9 @@
<div class="flex-nowrap px-3 py-1 row">
<div class="flex-grow-1 text-truncate" i18n>Fees</div>
<div class="d-flex justify-content-end">
- <span *ngIf="summary?.fees || summary?.fees === 0" class="mr-1">-</span>
+ @if (summary?.fees || summary?.fees === 0) {
+ <span class="mr-1">-</span>
+ }
<gf-value
class="justify-content-end"
[isCurrency]="true"
@@ -190,14 +192,27 @@
<div class="flex-grow-1 text-truncate" i18n>Emergency Fund</div>
<div
class="align-items-center d-flex justify-content-end"
- [ngClass]="{ 'cursor-pointer': hasPermissionToUpdateUserSettings }"
- (click)="hasPermissionToUpdateUserSettings && onEditEmergencyFund()"
+ [ngClass]="{
+ 'cursor-pointer':
+ hasPermissionToUpdateUserSettings &&
+ user?.subscription?.type !== 'Basic'
+ }"
+ (click)="
+ hasPermissionToUpdateUserSettings &&
+ user?.subscription?.type !== 'Basic' &&
+ onEditEmergencyFund()
+ "
>
- <ion-icon
- *ngIf="hasPermissionToUpdateUserSettings && !isLoading"
- class="mr-1 text-muted"
- name="ellipsis-horizontal-circle-outline"
- />
+ @if (
+ hasPermissionToUpdateUserSettings &&
+ user?.subscription?.type !== 'Basic' &&
+ !isLoading
+ ) {
+ <ion-icon
+ class="mr-1 text-muted"
+ name="ellipsis-horizontal-circle-outline"
+ />
+ }
<gf-value
class="justify-content-end"
[isCurrency]="true"
@@ -263,11 +278,9 @@
<div class="flex-nowrap px-3 py-1 row">
<div class="flex-grow-1 text-truncate" i18n>Liabilities</div>
<div class="d-flex justify-content-end">
- <span
- *ngIf="summary?.liabilities || summary?.liabilities === 0"
- class="mr-1"
- >-</span
- >
+ @if (summary?.liabilities || summary?.liabilities === 0) {
+ <span class="mr-1">-</span>
+ }
<gf-value
class="justify-content-end"
[isCurrency]="true"
diff --git a/apps/client/src/app/components/portfolio-summary/portfolio-summary.component.ts b/apps/client/src/app/components/portfolio-summary/portfolio-summary.component.ts
index 020a8fed0b..b99cc77dd2 100644
--- a/apps/client/src/app/components/portfolio-summary/portfolio-summary.component.ts
+++ b/apps/client/src/app/components/portfolio-summary/portfolio-summary.component.ts
@@ -1,5 +1,5 @@
import { getDateFnsLocale, getLocale } from '@ghostfolio/common/helper';
-import { PortfolioSummary } from '@ghostfolio/common/interfaces';
+import { PortfolioSummary, User } from '@ghostfolio/common/interfaces';
import { translate } from '@ghostfolio/ui/i18n';
import {
@@ -26,6 +26,7 @@ export class PortfolioSummaryComponent implements OnChanges, OnInit {
@Input() language: string;
@Input() locale = getLocale();
@Input() summary: PortfolioSummary;
+ @Input() user: User;
@Output() emergencyFundChanged = new EventEmitter<number>();