Browse Source

Feature/migrate toggle component to standalone (#5237)

* Migrate toggle component to standalone

* Update changelog
pull/5232/head
Kenrick Tandrian 3 weeks ago
committed by GitHub
parent
commit
f7efc54666
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 6
      CHANGELOG.md
  2. 4
      apps/client/src/app/components/home-holdings/home-holdings.component.ts
  3. 4
      apps/client/src/app/components/home-overview/home-overview.component.ts
  4. 4
      apps/client/src/app/components/markets/markets.component.ts
  5. 12
      apps/client/src/app/components/toggle/toggle.component.ts
  6. 13
      apps/client/src/app/components/toggle/toggle.module.ts
  7. 7
      apps/client/src/app/pages/portfolio/analysis/analysis-page.component.ts

6
CHANGELOG.md

@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## Unreleased
### Changed
- Refactored the toggle component to standalone
## 2.184.0 - 2025-07-22 ## 2.184.0 - 2025-07-22
### Added ### Added

4
apps/client/src/app/components/home-holdings/home-holdings.component.ts

@ -1,4 +1,4 @@
import { GfToggleModule } from '@ghostfolio/client/components/toggle/toggle.module'; import { GfToggleComponent } from '@ghostfolio/client/components/toggle/toggle.component';
import { DataService } from '@ghostfolio/client/services/data.service'; import { DataService } from '@ghostfolio/client/services/data.service';
import { ImpersonationStorageService } from '@ghostfolio/client/services/impersonation-storage.service'; import { ImpersonationStorageService } from '@ghostfolio/client/services/impersonation-storage.service';
import { UserService } from '@ghostfolio/client/services/user/user.service'; import { UserService } from '@ghostfolio/client/services/user/user.service';
@ -38,7 +38,7 @@ import { takeUntil } from 'rxjs/operators';
CommonModule, CommonModule,
FormsModule, FormsModule,
GfHoldingsTableComponent, GfHoldingsTableComponent,
GfToggleModule, GfToggleComponent,
GfTreemapChartComponent, GfTreemapChartComponent,
IonIcon, IonIcon,
MatButtonModule, MatButtonModule,

4
apps/client/src/app/components/home-overview/home-overview.component.ts

@ -1,5 +1,5 @@
import { GfPortfolioPerformanceModule } from '@ghostfolio/client/components/portfolio-performance/portfolio-performance.module'; import { GfPortfolioPerformanceModule } from '@ghostfolio/client/components/portfolio-performance/portfolio-performance.module';
import { ToggleComponent } from '@ghostfolio/client/components/toggle/toggle.component'; import { GfToggleComponent } from '@ghostfolio/client/components/toggle/toggle.component';
import { LayoutService } from '@ghostfolio/client/core/layout.service'; import { LayoutService } from '@ghostfolio/client/core/layout.service';
import { DataService } from '@ghostfolio/client/services/data.service'; import { DataService } from '@ghostfolio/client/services/data.service';
import { ImpersonationStorageService } from '@ghostfolio/client/services/impersonation-storage.service'; import { ImpersonationStorageService } from '@ghostfolio/client/services/impersonation-storage.service';
@ -43,7 +43,7 @@ import { takeUntil } from 'rxjs/operators';
templateUrl: './home-overview.html' templateUrl: './home-overview.html'
}) })
export class GfHomeOverviewComponent implements OnDestroy, OnInit { export class GfHomeOverviewComponent implements OnDestroy, OnInit {
public dateRangeOptions = ToggleComponent.DEFAULT_DATE_RANGE_OPTIONS; public dateRangeOptions = GfToggleComponent.DEFAULT_DATE_RANGE_OPTIONS;
public deviceType: string; public deviceType: string;
public errors: AssetProfileIdentifier[]; public errors: AssetProfileIdentifier[];
public hasError: boolean; public hasError: boolean;

4
apps/client/src/app/components/markets/markets.component.ts

@ -1,5 +1,5 @@
import { GfFearAndGreedIndexModule } from '@ghostfolio/client/components/fear-and-greed-index/fear-and-greed-index.module'; import { GfFearAndGreedIndexModule } from '@ghostfolio/client/components/fear-and-greed-index/fear-and-greed-index.module';
import { GfToggleModule } from '@ghostfolio/client/components/toggle/toggle.module'; import { GfToggleComponent } from '@ghostfolio/client/components/toggle/toggle.component';
import { DataService } from '@ghostfolio/client/services/data.service'; import { DataService } from '@ghostfolio/client/services/data.service';
import { UserService } from '@ghostfolio/client/services/user/user.service'; import { UserService } from '@ghostfolio/client/services/user/user.service';
import { resetHours } from '@ghostfolio/common/helper'; import { resetHours } from '@ghostfolio/common/helper';
@ -34,7 +34,7 @@ import { takeUntil } from 'rxjs/operators';
GfBenchmarkComponent, GfBenchmarkComponent,
GfFearAndGreedIndexModule, GfFearAndGreedIndexModule,
GfLineChartComponent, GfLineChartComponent,
GfToggleModule GfToggleComponent
], ],
schemas: [CUSTOM_ELEMENTS_SCHEMA], schemas: [CUSTOM_ELEMENTS_SCHEMA],
selector: 'gf-markets', selector: 'gf-markets',

12
apps/client/src/app/components/toggle/toggle.component.ts

@ -1,5 +1,6 @@
import { ToggleOption } from '@ghostfolio/common/interfaces'; import { ToggleOption } from '@ghostfolio/common/interfaces';
import { CommonModule } from '@angular/common';
import { import {
ChangeDetectionStrategy, ChangeDetectionStrategy,
Component, Component,
@ -8,16 +9,17 @@ import {
OnChanges, OnChanges,
Output Output
} from '@angular/core'; } from '@angular/core';
import { FormControl } from '@angular/forms'; import { FormControl, ReactiveFormsModule } from '@angular/forms';
import { MatRadioModule } from '@angular/material/radio';
@Component({ @Component({
selector: 'gf-toggle',
changeDetection: ChangeDetectionStrategy.OnPush, changeDetection: ChangeDetectionStrategy.OnPush,
templateUrl: './toggle.component.html', imports: [CommonModule, MatRadioModule, ReactiveFormsModule],
selector: 'gf-toggle',
styleUrls: ['./toggle.component.scss'], styleUrls: ['./toggle.component.scss'],
standalone: false templateUrl: './toggle.component.html'
}) })
export class ToggleComponent implements OnChanges { export class GfToggleComponent implements OnChanges {
public static DEFAULT_DATE_RANGE_OPTIONS: ToggleOption[] = [ public static DEFAULT_DATE_RANGE_OPTIONS: ToggleOption[] = [
{ label: $localize`Today`, value: '1d' }, { label: $localize`Today`, value: '1d' },
{ label: $localize`YTD`, value: 'ytd' }, { label: $localize`YTD`, value: 'ytd' },

13
apps/client/src/app/components/toggle/toggle.module.ts

@ -1,13 +0,0 @@
import { CommonModule } from '@angular/common';
import { NgModule } from '@angular/core';
import { ReactiveFormsModule } from '@angular/forms';
import { MatRadioModule } from '@angular/material/radio';
import { ToggleComponent } from './toggle.component';
@NgModule({
declarations: [ToggleComponent],
exports: [ToggleComponent],
imports: [CommonModule, MatRadioModule, ReactiveFormsModule]
})
export class GfToggleModule {}

7
apps/client/src/app/pages/portfolio/analysis/analysis-page.component.ts

@ -1,7 +1,6 @@
import { GfBenchmarkComparatorModule } from '@ghostfolio/client/components/benchmark-comparator/benchmark-comparator.module'; import { GfBenchmarkComparatorModule } from '@ghostfolio/client/components/benchmark-comparator/benchmark-comparator.module';
import { GfInvestmentChartModule } from '@ghostfolio/client/components/investment-chart/investment-chart.module'; import { GfInvestmentChartModule } from '@ghostfolio/client/components/investment-chart/investment-chart.module';
import { ToggleComponent } from '@ghostfolio/client/components/toggle/toggle.component'; import { GfToggleComponent } from '@ghostfolio/client/components/toggle/toggle.component';
import { GfToggleModule } from '@ghostfolio/client/components/toggle/toggle.module';
import { DataService } from '@ghostfolio/client/services/data.service'; import { DataService } from '@ghostfolio/client/services/data.service';
import { ImpersonationStorageService } from '@ghostfolio/client/services/impersonation-storage.service'; import { ImpersonationStorageService } from '@ghostfolio/client/services/impersonation-storage.service';
import { UserService } from '@ghostfolio/client/services/user/user.service'; import { UserService } from '@ghostfolio/client/services/user/user.service';
@ -49,7 +48,7 @@ import { takeUntil } from 'rxjs/operators';
GfBenchmarkComparatorModule, GfBenchmarkComparatorModule,
GfInvestmentChartModule, GfInvestmentChartModule,
GfPremiumIndicatorComponent, GfPremiumIndicatorComponent,
GfToggleModule, GfToggleComponent,
GfValueComponent, GfValueComponent,
IonIcon, IonIcon,
MatButtonModule, MatButtonModule,
@ -69,7 +68,7 @@ export class GfAnalysisPageComponent implements OnDestroy, OnInit {
public benchmarkDataItems: HistoricalDataItem[] = []; public benchmarkDataItems: HistoricalDataItem[] = [];
public benchmarks: Partial<SymbolProfile>[]; public benchmarks: Partial<SymbolProfile>[];
public bottom3: PortfolioPosition[]; public bottom3: PortfolioPosition[];
public dateRangeOptions = ToggleComponent.DEFAULT_DATE_RANGE_OPTIONS; public dateRangeOptions = GfToggleComponent.DEFAULT_DATE_RANGE_OPTIONS;
public deviceType: string; public deviceType: string;
public dividendsByGroup: InvestmentItem[]; public dividendsByGroup: InvestmentItem[];
public dividendTimelineDataLabel = $localize`Dividend`; public dividendTimelineDataLabel = $localize`Dividend`;

Loading…
Cancel
Save