|
|
@ -31,6 +31,7 @@ import { |
|
|
DestroyRef, |
|
|
DestroyRef, |
|
|
inject, |
|
|
inject, |
|
|
OnInit, |
|
|
OnInit, |
|
|
|
|
|
signal, |
|
|
viewChild |
|
|
viewChild |
|
|
} from '@angular/core'; |
|
|
} from '@angular/core'; |
|
|
import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; |
|
|
import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; |
|
|
@ -86,7 +87,7 @@ export class GfAnalysisPageComponent implements OnInit { |
|
|
protected isLoadingInvestmentChart: boolean; |
|
|
protected isLoadingInvestmentChart: boolean; |
|
|
protected isLoadingInvestmentTimelineChart: boolean; |
|
|
protected isLoadingInvestmentTimelineChart: boolean; |
|
|
protected isLoadingPortfolioPrompt: boolean; |
|
|
protected isLoadingPortfolioPrompt: boolean; |
|
|
protected mode: GroupBy = 'month'; |
|
|
protected readonly mode = signal<GroupBy>('month'); |
|
|
protected readonly modeOptions: ToggleOption[] = [ |
|
|
protected readonly modeOptions: ToggleOption[] = [ |
|
|
{ label: $localize`Monthly`, value: 'month' }, |
|
|
{ label: $localize`Monthly`, value: 'month' }, |
|
|
{ label: $localize`Yearly`, value: 'year' } |
|
|
{ label: $localize`Yearly`, value: 'year' } |
|
|
@ -136,7 +137,7 @@ export class GfAnalysisPageComponent implements OnInit { |
|
|
return undefined; |
|
|
return undefined; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
return this.mode === 'year' |
|
|
return this.mode() === 'year' |
|
|
? savingsRatePerMonth * 12 |
|
|
? savingsRatePerMonth * 12 |
|
|
: savingsRatePerMonth; |
|
|
: savingsRatePerMonth; |
|
|
} |
|
|
} |
|
|
@ -186,7 +187,7 @@ export class GfAnalysisPageComponent implements OnInit { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
protected onChangeGroupBy(aMode: GroupBy) { |
|
|
protected onChangeGroupBy(aMode: GroupBy) { |
|
|
this.mode = aMode; |
|
|
this.mode.set(aMode); |
|
|
this.fetchDividendsAndInvestments(); |
|
|
this.fetchDividendsAndInvestments(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ -238,7 +239,7 @@ export class GfAnalysisPageComponent implements OnInit { |
|
|
this.dataService |
|
|
this.dataService |
|
|
.fetchDividends({ |
|
|
.fetchDividends({ |
|
|
filters: this.userService.getFilters(), |
|
|
filters: this.userService.getFilters(), |
|
|
groupBy: this.mode, |
|
|
groupBy: this.mode(), |
|
|
range: this.user?.settings?.dateRange ?? DEFAULT_DATE_RANGE |
|
|
range: this.user?.settings?.dateRange ?? DEFAULT_DATE_RANGE |
|
|
}) |
|
|
}) |
|
|
.pipe(takeUntilDestroyed(this.destroyRef)) |
|
|
.pipe(takeUntilDestroyed(this.destroyRef)) |
|
|
@ -253,7 +254,7 @@ export class GfAnalysisPageComponent implements OnInit { |
|
|
this.dataService |
|
|
this.dataService |
|
|
.fetchInvestments({ |
|
|
.fetchInvestments({ |
|
|
filters: this.userService.getFilters(), |
|
|
filters: this.userService.getFilters(), |
|
|
groupBy: this.mode, |
|
|
groupBy: this.mode(), |
|
|
range: this.user?.settings?.dateRange ?? DEFAULT_DATE_RANGE |
|
|
range: this.user?.settings?.dateRange ?? DEFAULT_DATE_RANGE |
|
|
}) |
|
|
}) |
|
|
.pipe(takeUntilDestroyed(this.destroyRef)) |
|
|
.pipe(takeUntilDestroyed(this.destroyRef)) |
|
|
@ -261,7 +262,7 @@ export class GfAnalysisPageComponent implements OnInit { |
|
|
this.investmentsByGroup = investments; |
|
|
this.investmentsByGroup = investments; |
|
|
this.streaks = streaks; |
|
|
this.streaks = streaks; |
|
|
this.unitCurrentStreak = |
|
|
this.unitCurrentStreak = |
|
|
this.mode === 'year' |
|
|
this.mode() === 'year' |
|
|
? this.streaks?.currentStreak === 1 |
|
|
? this.streaks?.currentStreak === 1 |
|
|
? translate('YEAR') |
|
|
? translate('YEAR') |
|
|
: translate('YEARS') |
|
|
: translate('YEARS') |
|
|
@ -269,7 +270,7 @@ export class GfAnalysisPageComponent implements OnInit { |
|
|
? translate('MONTH') |
|
|
? translate('MONTH') |
|
|
: translate('MONTHS'); |
|
|
: translate('MONTHS'); |
|
|
this.unitLongestStreak = |
|
|
this.unitLongestStreak = |
|
|
this.mode === 'year' |
|
|
this.mode() === 'year' |
|
|
? this.streaks?.longestStreak === 1 |
|
|
? this.streaks?.longestStreak === 1 |
|
|
? translate('YEAR') |
|
|
? translate('YEAR') |
|
|
: translate('YEARS') |
|
|
: translate('YEARS') |
|
|
|