From d45cef1725c83967a4357eba965f5a01f214e239 Mon Sep 17 00:00:00 2001 From: Kenrick Tandrian <60643640+KenTandrian@users.noreply.github.com> Date: Mon, 1 Sep 2025 16:56:48 +0700 Subject: [PATCH] Task/migrate benchmark comparator component to standalone (#5446) * Migrate benchmark comparator component to standalone * Update changelog --- CHANGELOG.md | 1 + .../benchmark-comparator.component.ts | 24 ++++++++++++++--- .../benchmark-comparator.module.ts | 27 ------------------- .../analysis/analysis-page.component.ts | 4 +-- 4 files changed, 23 insertions(+), 33 deletions(-) delete mode 100644 apps/client/src/app/components/benchmark-comparator/benchmark-comparator.module.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index 160ec0e47..1e4c43ff3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed - Localized the content of the about page +- Refactored the benchmark comparator 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/benchmark-comparator/benchmark-comparator.component.ts b/apps/client/src/app/components/benchmark-comparator/benchmark-comparator.component.ts index d557ae88a..7f03ea57f 100644 --- a/apps/client/src/app/components/benchmark-comparator/benchmark-comparator.component.ts +++ b/apps/client/src/app/components/benchmark-comparator/benchmark-comparator.component.ts @@ -15,7 +15,9 @@ import { LineChartItem, User } from '@ghostfolio/common/interfaces'; import { hasPermission, permissions } from '@ghostfolio/common/permissions'; import { internalRoutes } from '@ghostfolio/common/routes/routes'; import { ColorScheme } from '@ghostfolio/common/types'; +import { GfPremiumIndicatorComponent } from '@ghostfolio/ui/premium-indicator'; +import { CommonModule } from '@angular/common'; import { ChangeDetectionStrategy, Component, @@ -26,6 +28,10 @@ import { Output, ViewChild } from '@angular/core'; +import { FormsModule, ReactiveFormsModule } from '@angular/forms'; +import { MatSelectModule } from '@angular/material/select'; +import { RouterModule } from '@angular/router'; +import { IonIcon } from '@ionic/angular/standalone'; import { SymbolProfile } from '@prisma/client'; import { Chart, @@ -42,15 +48,25 @@ import 'chartjs-adapter-date-fns'; import annotationPlugin from 'chartjs-plugin-annotation'; import { addIcons } from 'ionicons'; import { arrowForwardOutline } from 'ionicons/icons'; +import { NgxSkeletonLoaderModule } from 'ngx-skeleton-loader'; @Component({ - selector: 'gf-benchmark-comparator', changeDetection: ChangeDetectionStrategy.OnPush, - templateUrl: './benchmark-comparator.component.html', + imports: [ + CommonModule, + FormsModule, + GfPremiumIndicatorComponent, + IonIcon, + MatSelectModule, + NgxSkeletonLoaderModule, + ReactiveFormsModule, + RouterModule + ], + selector: 'gf-benchmark-comparator', styleUrls: ['./benchmark-comparator.component.scss'], - standalone: false + templateUrl: './benchmark-comparator.component.html' }) -export class BenchmarkComparatorComponent implements OnChanges, OnDestroy { +export class GfBenchmarkComparatorComponent implements OnChanges, OnDestroy { @Input() benchmark: Partial; @Input() benchmarkDataItems: LineChartItem[] = []; @Input() benchmarks: Partial[]; diff --git a/apps/client/src/app/components/benchmark-comparator/benchmark-comparator.module.ts b/apps/client/src/app/components/benchmark-comparator/benchmark-comparator.module.ts deleted file mode 100644 index c2df436a4..000000000 --- a/apps/client/src/app/components/benchmark-comparator/benchmark-comparator.module.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { GfPremiumIndicatorComponent } from '@ghostfolio/ui/premium-indicator'; - -import { CommonModule } from '@angular/common'; -import { NgModule } from '@angular/core'; -import { FormsModule, ReactiveFormsModule } from '@angular/forms'; -import { MatSelectModule } from '@angular/material/select'; -import { RouterModule } from '@angular/router'; -import { IonIcon } from '@ionic/angular/standalone'; -import { NgxSkeletonLoaderModule } from 'ngx-skeleton-loader'; - -import { BenchmarkComparatorComponent } from './benchmark-comparator.component'; - -@NgModule({ - declarations: [BenchmarkComparatorComponent], - exports: [BenchmarkComparatorComponent], - imports: [ - CommonModule, - FormsModule, - GfPremiumIndicatorComponent, - IonIcon, - MatSelectModule, - NgxSkeletonLoaderModule, - ReactiveFormsModule, - RouterModule - ] -}) -export class GfBenchmarkComparatorModule {} diff --git a/apps/client/src/app/pages/portfolio/analysis/analysis-page.component.ts b/apps/client/src/app/pages/portfolio/analysis/analysis-page.component.ts index 0fd9037bf..89f294a35 100644 --- a/apps/client/src/app/pages/portfolio/analysis/analysis-page.component.ts +++ b/apps/client/src/app/pages/portfolio/analysis/analysis-page.component.ts @@ -1,4 +1,4 @@ -import { GfBenchmarkComparatorModule } from '@ghostfolio/client/components/benchmark-comparator/benchmark-comparator.module'; +import { GfBenchmarkComparatorComponent } from '@ghostfolio/client/components/benchmark-comparator/benchmark-comparator.component'; import { GfInvestmentChartModule } from '@ghostfolio/client/components/investment-chart/investment-chart.module'; import { DataService } from '@ghostfolio/client/services/data.service'; import { ImpersonationStorageService } from '@ghostfolio/client/services/impersonation-storage.service'; @@ -46,7 +46,7 @@ import { takeUntil } from 'rxjs/operators'; @Component({ imports: [ - GfBenchmarkComparatorModule, + GfBenchmarkComparatorComponent, GfInvestmentChartModule, GfPremiumIndicatorComponent, GfToggleComponent,