From 37080da364abca2c846c3043044fedda3bf46feb Mon Sep 17 00:00:00 2001 From: Kenrick Tandrian <60643640+KenTandrian@users.noreply.github.com> Date: Tue, 2 Sep 2025 20:15:31 +0700 Subject: [PATCH] Task/migrate portfolio summary component to standalone (#5450) * Migrate portfolio summary component to standalone * Update changelog --- CHANGELOG.md | 1 + .../home-summary/home-summary.component.ts | 4 ++-- .../portfolio-summary.component.ts | 12 ++++++++---- .../portfolio-summary/portfolio-summary.module.ts | 15 --------------- 4 files changed, 11 insertions(+), 21 deletions(-) delete mode 100644 apps/client/src/app/components/portfolio-summary/portfolio-summary.module.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index 57c36ce0f..c56c56723 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 - Refactored the dialog footer component - Refactored the dialog header component - Refactored the benchmark comparator component to standalone +- Refactored the portfolio summary component to standalone - Refactored the world map chart component to standalone - Improved the language localization for German (`de`) - Upgraded the _Stripe_ dependencies 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 e21210477..d49f9c26f 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 @@ -1,4 +1,4 @@ -import { GfPortfolioSummaryModule } from '@ghostfolio/client/components/portfolio-summary/portfolio-summary.module'; +import { GfPortfolioSummaryComponent } from '@ghostfolio/client/components/portfolio-summary/portfolio-summary.component'; import { DataService } from '@ghostfolio/client/services/data.service'; import { ImpersonationStorageService } from '@ghostfolio/client/services/impersonation-storage.service'; import { UserService } from '@ghostfolio/client/services/user/user.service'; @@ -22,7 +22,7 @@ import { Subject } from 'rxjs'; import { takeUntil } from 'rxjs/operators'; @Component({ - imports: [GfPortfolioSummaryModule, MatCardModule], + imports: [GfPortfolioSummaryComponent, MatCardModule], schemas: [CUSTOM_ELEMENTS_SCHEMA], selector: 'gf-home-summary', styleUrls: ['./home-summary.scss'], 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 9bc8ed773..849f018ad 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 @@ -2,7 +2,9 @@ import { NotificationService } from '@ghostfolio/client/core/notification/notifi import { getDateFnsLocale, getLocale } from '@ghostfolio/common/helper'; import { PortfolioSummary, User } from '@ghostfolio/common/interfaces'; import { translate } from '@ghostfolio/ui/i18n'; +import { GfValueComponent } from '@ghostfolio/ui/value'; +import { CommonModule } from '@angular/common'; import { ChangeDetectionStrategy, Component, @@ -11,6 +13,8 @@ import { OnChanges, Output } from '@angular/core'; +import { MatTooltipModule } from '@angular/material/tooltip'; +import { IonIcon } from '@ionic/angular/standalone'; import { formatDistanceToNow } from 'date-fns'; import { addIcons } from 'ionicons'; import { @@ -19,13 +23,13 @@ import { } from 'ionicons/icons'; @Component({ - selector: 'gf-portfolio-summary', changeDetection: ChangeDetectionStrategy.OnPush, - templateUrl: './portfolio-summary.component.html', + imports: [CommonModule, GfValueComponent, IonIcon, MatTooltipModule], + selector: 'gf-portfolio-summary', styleUrls: ['./portfolio-summary.component.scss'], - standalone: false + templateUrl: './portfolio-summary.component.html' }) -export class PortfolioSummaryComponent implements OnChanges { +export class GfPortfolioSummaryComponent implements OnChanges { @Input() baseCurrency: string; @Input() hasPermissionToUpdateUserSettings: boolean; @Input() isLoading: boolean; diff --git a/apps/client/src/app/components/portfolio-summary/portfolio-summary.module.ts b/apps/client/src/app/components/portfolio-summary/portfolio-summary.module.ts deleted file mode 100644 index b35f1e317..000000000 --- a/apps/client/src/app/components/portfolio-summary/portfolio-summary.module.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { GfValueComponent } from '@ghostfolio/ui/value'; - -import { CommonModule } from '@angular/common'; -import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core'; -import { MatTooltipModule } from '@angular/material/tooltip'; - -import { PortfolioSummaryComponent } from './portfolio-summary.component'; - -@NgModule({ - declarations: [PortfolioSummaryComponent], - exports: [PortfolioSummaryComponent], - imports: [CommonModule, GfValueComponent, MatTooltipModule], - schemas: [CUSTOM_ELEMENTS_SCHEMA] -}) -export class GfPortfolioSummaryModule {}