From 7e246ed072a67d43b0ca79f99af807aac954c56b Mon Sep 17 00:00:00 2001 From: FlavienLM Date: Wed, 1 Oct 2025 20:07:02 +0200 Subject: [PATCH] revert: fireWealth interface in fire-calculator and update changelog --- CHANGELOG.md | 1 + libs/common/src/lib/interfaces/index.ts | 2 +- .../interfaces/portfolio-summary.interface.ts | 7 ++----- .../fire-calculator.component.ts | 18 ++++++------------ 4 files changed, 10 insertions(+), 18 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e94d88d01..d020d7ea8 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 - Localized the number formatting of the y-axis labels in the line chart component - Improved the wording of the 4% rule in the _FIRE_ section - Improved the language localization for German (`de`) +- Changed `fireWealth` from a single `number` to a structured interface ## 2.203.0 - 2025-09-27 diff --git a/libs/common/src/lib/interfaces/index.ts b/libs/common/src/lib/interfaces/index.ts index beb029409..1da2236e8 100644 --- a/libs/common/src/lib/interfaces/index.ts +++ b/libs/common/src/lib/interfaces/index.ts @@ -19,7 +19,7 @@ import type { EnhancedSymbolProfile } from './enhanced-symbol-profile.interface' import type { Export } from './export.interface'; import type { FilterGroup } from './filter-group.interface'; import type { Filter } from './filter.interface'; -import { FireWealth } from './fire-wealth.interface'; +import type { FireWealth } from './fire-wealth.interface'; import type { HistoricalDataItem } from './historical-data-item.interface'; import type { HoldingWithParents } from './holding-with-parents.interface'; import type { Holding } from './holding.interface'; diff --git a/libs/common/src/lib/interfaces/portfolio-summary.interface.ts b/libs/common/src/lib/interfaces/portfolio-summary.interface.ts index c3cf56ba4..05fac0ba0 100644 --- a/libs/common/src/lib/interfaces/portfolio-summary.interface.ts +++ b/libs/common/src/lib/interfaces/portfolio-summary.interface.ts @@ -1,3 +1,4 @@ +import { FireWealth } from './fire-wealth.interface'; import { PortfolioPerformance } from './portfolio-performance.interface'; export interface PortfolioSummary extends PortfolioPerformance { @@ -16,11 +17,7 @@ export interface PortfolioSummary extends PortfolioPerformance { fees: number; filteredValueInBaseCurrency?: number; filteredValueInPercentage?: number; - fireWealth: { - today: { - valueInBaseCurrency: number; - }; - }; + fireWealth: FireWealth; grossPerformance: number; grossPerformanceWithCurrencyEffect: number; interest: number; diff --git a/libs/ui/src/lib/fire-calculator/fire-calculator.component.ts b/libs/ui/src/lib/fire-calculator/fire-calculator.component.ts index 45effcd22..64fbe1b74 100644 --- a/libs/ui/src/lib/fire-calculator/fire-calculator.component.ts +++ b/libs/ui/src/lib/fire-calculator/fire-calculator.component.ts @@ -4,7 +4,6 @@ import { } from '@ghostfolio/common/chart-helper'; import { primaryColorRgb } from '@ghostfolio/common/config'; import { getLocale } from '@ghostfolio/common/helper'; -import { FireWealth } from '@ghostfolio/common/interfaces'; import { ColorScheme } from '@ghostfolio/common/types'; import { CommonModule } from '@angular/common'; @@ -80,7 +79,7 @@ export class GfFireCalculatorComponent implements OnChanges, OnDestroy { @Input() colorScheme: ColorScheme; @Input() currency: string; @Input() deviceType: string; - @Input() fireWealth: FireWealth; + @Input() fireWealth: number; @Input() hasPermissionToUpdateUserSettings: boolean; @Input() locale = getLocale(); @Input() projectedTotalAmount: number; @@ -157,15 +156,12 @@ export class GfFireCalculatorComponent implements OnChanges, OnDestroy { } public ngOnChanges() { - if ( - isNumber(this.fireWealth.today.valueInBaseCurrency) && - this.fireWealth.today.valueInBaseCurrency >= 0 - ) { + if (isNumber(this.fireWealth) && this.fireWealth >= 0) { this.calculatorForm.setValue( { annualInterestRate: this.annualInterestRate ?? 5, paymentPerPeriod: this.savingsRate ?? 0, - principalInvestmentAmount: this.fireWealth.today.valueInBaseCurrency, + principalInvestmentAmount: this.fireWealth, projectedTotalAmount: this.projectedTotalAmount ?? 0, retirementDate: this.retirementDate ?? this.DEFAULT_RETIREMENT_DATE }, @@ -397,11 +393,9 @@ export class GfFireCalculatorComponent implements OnChanges, OnDestroy { r }); - datasetDeposit.data.push(this.fireWealth.today.valueInBaseCurrency); + datasetDeposit.data.push(this.fireWealth); datasetInterest.data.push(interest.toNumber()); - datasetSavings.data.push( - principal.minus(this.fireWealth.today.valueInBaseCurrency) - ); + datasetSavings.data.push(principal.minus(this.fireWealth).toNumber()); } return { @@ -411,7 +405,7 @@ export class GfFireCalculatorComponent implements OnChanges, OnDestroy { } private getP() { - return this.fireWealth.today.valueInBaseCurrency || 0; + return this.fireWealth || 0; } private getPeriodsToRetire(): number {