|
|
|
@ -15,6 +15,7 @@ import { ColorScheme } from '@ghostfolio/common/types'; |
|
|
|
import type { SymbolProfile } from '@ghostfolio/prisma/browser'; |
|
|
|
import { |
|
|
|
getTimeSeriesTooltipOptions, |
|
|
|
onPrefersColorSchemeChange, |
|
|
|
registerChartConfiguration |
|
|
|
} from '@ghostfolio/ui/chart'; |
|
|
|
import { GfPremiumIndicatorComponent } from '@ghostfolio/ui/premium-indicator'; |
|
|
|
@ -27,6 +28,7 @@ import { |
|
|
|
OnChanges, |
|
|
|
OnDestroy, |
|
|
|
output, |
|
|
|
SimpleChanges, |
|
|
|
viewChild |
|
|
|
} from '@angular/core'; |
|
|
|
import { FormsModule, ReactiveFormsModule } from '@angular/forms'; |
|
|
|
@ -68,7 +70,7 @@ export class GfBenchmarkComparatorComponent implements OnChanges, OnDestroy { |
|
|
|
public readonly benchmark = input<Partial<SymbolProfile>>(); |
|
|
|
public readonly benchmarkDataItems = input<LineChartItem[]>([]); |
|
|
|
public readonly benchmarks = input<Partial<SymbolProfile>[]>(); |
|
|
|
public readonly colorScheme = input.required<ColorScheme>(); |
|
|
|
public readonly colorScheme = input<ColorScheme>(); |
|
|
|
public readonly isLoading = input<boolean>(); |
|
|
|
public readonly locale = input(getLocale()); |
|
|
|
public readonly performanceDataItems = input.required<LineChartItem[]>(); |
|
|
|
@ -76,7 +78,7 @@ export class GfBenchmarkComparatorComponent implements OnChanges, OnDestroy { |
|
|
|
|
|
|
|
public readonly benchmarkChanged = output<string>(); |
|
|
|
|
|
|
|
protected chart: Chart<'line'>; |
|
|
|
protected chart?: Chart<'line'>; |
|
|
|
protected hasPermissionToAccessAdminControl: boolean; |
|
|
|
protected readonly routerLinkAdminControlMarketData = |
|
|
|
internalRoutes.adminControl.subRoutes.marketData.routerLink; |
|
|
|
@ -96,10 +98,24 @@ export class GfBenchmarkComparatorComponent implements OnChanges, OnDestroy { |
|
|
|
|
|
|
|
registerChartConfiguration(); |
|
|
|
|
|
|
|
onPrefersColorSchemeChange(() => { |
|
|
|
if (this.chart && !this.colorScheme()) { |
|
|
|
this.chart.destroy(); |
|
|
|
this.chart = undefined; |
|
|
|
|
|
|
|
this.initialize(); |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
addIcons({ arrowForwardOutline }); |
|
|
|
} |
|
|
|
|
|
|
|
public ngOnChanges() { |
|
|
|
public ngOnChanges(changes: SimpleChanges) { |
|
|
|
if (changes.colorScheme && this.chart) { |
|
|
|
this.chart.destroy(); |
|
|
|
this.chart = undefined; |
|
|
|
} |
|
|
|
|
|
|
|
this.hasPermissionToAccessAdminControl = hasPermission( |
|
|
|
this.user()?.permissions, |
|
|
|
permissions.accessAdminControl |
|
|
|
|