From 00e50c6abec9c5967a025e5b40468c8354653308 Mon Sep 17 00:00:00 2001 From: Thomas Kaul <4159106+dtslvr@users.noreply.github.com> Date: Sat, 8 Jun 2024 19:31:50 +0200 Subject: [PATCH] Feature/improve portfolio summary (#3472) * Improve portfolio summary * Update changelog --- CHANGELOG.md | 1 + .../home-summary/home-summary.component.ts | 27 +------------ .../components/home-summary/home-summary.html | 1 + .../home-summary/home-summary.module.ts | 8 +--- .../portfolio-summary.component.html | 39 ++++++++++++------- .../portfolio-summary.component.ts | 3 +- 6 files changed, 32 insertions(+), 47 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6e1df748b..60f0fd3ab 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 b67b67ce5..861d702b6 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 c00fb5770..9434f7018 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)" /> 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 75cea9962..2176d0aa7 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 6b80e87b6..8f7fb470d 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 @@
Fees
- - + @if (summary?.fees || summary?.fees === 0) { + - + } Emergency Fund
- + @if ( + hasPermissionToUpdateUserSettings && + user?.subscription?.type !== 'Basic' && + !isLoading + ) { + + }
Liabilities
- - + @if (summary?.liabilities || summary?.liabilities === 0) { + - + } ();