From 7c8104224441d621ad1d729e6fbc6ced717a5e71 Mon Sep 17 00:00:00 2001 From: Kenrick Tandrian <60643640+KenTandrian@users.noreply.github.com> Date: Thu, 14 Aug 2025 23:05:02 +0700 Subject: [PATCH] Task/migrate portfolio performance component to standalone (#5363) * Migrate portfolio performance component to standalone * Update changelog --- CHANGELOG.md | 1 + .../home-overview/home-overview.component.ts | 4 ++-- .../portfolio-performance.component.ts | 12 ++++++++---- .../portfolio-performance.module.ts | 16 ---------------- 4 files changed, 11 insertions(+), 22 deletions(-) delete mode 100644 apps/client/src/app/components/portfolio-performance/portfolio-performance.module.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index 0637e235d..e7d2797e1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Moved the chart of the account detail dialog from experimental to general availability - Improved the dynamic numerical precision for various values in the account detail dialog - Extended the accounts endpoint by dividend and interest +- Refactored the portfolio performance component to standalone - Improved the language localization for Portuguese (`pt`) - Improved the language localization for Spanish (`es`) diff --git a/apps/client/src/app/components/home-overview/home-overview.component.ts b/apps/client/src/app/components/home-overview/home-overview.component.ts index acb253935..6c9694a19 100644 --- a/apps/client/src/app/components/home-overview/home-overview.component.ts +++ b/apps/client/src/app/components/home-overview/home-overview.component.ts @@ -1,4 +1,4 @@ -import { GfPortfolioPerformanceModule } from '@ghostfolio/client/components/portfolio-performance/portfolio-performance.module'; +import { GfPortfolioPerformanceComponent } from '@ghostfolio/client/components/portfolio-performance/portfolio-performance.component'; import { LayoutService } from '@ghostfolio/client/core/layout.service'; import { DataService } from '@ghostfolio/client/services/data.service'; import { ImpersonationStorageService } from '@ghostfolio/client/services/impersonation-storage.service'; @@ -32,7 +32,7 @@ import { takeUntil } from 'rxjs/operators'; imports: [ CommonModule, GfLineChartComponent, - GfPortfolioPerformanceModule, + GfPortfolioPerformanceComponent, MatButtonModule, RouterModule ], diff --git a/apps/client/src/app/components/portfolio-performance/portfolio-performance.component.ts b/apps/client/src/app/components/portfolio-performance/portfolio-performance.component.ts index caef1082f..c98a26831 100644 --- a/apps/client/src/app/components/portfolio-performance/portfolio-performance.component.ts +++ b/apps/client/src/app/components/portfolio-performance/portfolio-performance.component.ts @@ -8,7 +8,9 @@ import { PortfolioPerformance, ResponseError } from '@ghostfolio/common/interfaces'; +import { GfValueComponent } from '@ghostfolio/ui/value'; +import { CommonModule } from '@angular/common'; import { ChangeDetectionStrategy, Component, @@ -17,19 +19,21 @@ import { OnChanges, ViewChild } from '@angular/core'; +import { IonIcon } from '@ionic/angular/standalone'; import { CountUp } from 'countup.js'; import { addIcons } from 'ionicons'; import { timeOutline } from 'ionicons/icons'; import { isNumber } from 'lodash'; +import { NgxSkeletonLoaderModule } from 'ngx-skeleton-loader'; @Component({ - selector: 'gf-portfolio-performance', changeDetection: ChangeDetectionStrategy.OnPush, - templateUrl: './portfolio-performance.component.html', + imports: [CommonModule, GfValueComponent, IonIcon, NgxSkeletonLoaderModule], + selector: 'gf-portfolio-performance', styleUrls: ['./portfolio-performance.component.scss'], - standalone: false + templateUrl: './portfolio-performance.component.html' }) -export class PortfolioPerformanceComponent implements OnChanges { +export class GfPortfolioPerformanceComponent implements OnChanges { @Input() deviceType: string; @Input() errors: ResponseError['errors']; @Input() isAllTimeHigh: boolean; diff --git a/apps/client/src/app/components/portfolio-performance/portfolio-performance.module.ts b/apps/client/src/app/components/portfolio-performance/portfolio-performance.module.ts deleted file mode 100644 index e5b606255..000000000 --- a/apps/client/src/app/components/portfolio-performance/portfolio-performance.module.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { GfValueComponent } from '@ghostfolio/ui/value'; - -import { CommonModule } from '@angular/common'; -import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core'; -import { IonIcon } from '@ionic/angular/standalone'; -import { NgxSkeletonLoaderModule } from 'ngx-skeleton-loader'; - -import { PortfolioPerformanceComponent } from './portfolio-performance.component'; - -@NgModule({ - declarations: [PortfolioPerformanceComponent], - exports: [PortfolioPerformanceComponent], - imports: [CommonModule, GfValueComponent, IonIcon, NgxSkeletonLoaderModule], - schemas: [CUSTOM_ELEMENTS_SCHEMA] -}) -export class GfPortfolioPerformanceModule {}