diff --git a/apps/client/src/app/components/home-market/home-market.html b/apps/client/src/app/components/home-market/home-market.html index 7ce07b6e9..46c8f1d59 100644 --- a/apps/client/src/app/components/home-market/home-market.html +++ b/apps/client/src/app/components/home-market/home-market.html @@ -31,6 +31,7 @@ @@ -44,9 +44,9 @@ *ngIf="element?.trend200d !== 'UNKNOWN'" [value]=" element?.trend200d === 'UP' - ? 1 + ? 0.001 : element?.trend200d === 'DOWN' - ? -1 + ? -0.001 : 0 " > diff --git a/libs/ui/src/lib/benchmark/benchmark.component.ts b/libs/ui/src/lib/benchmark/benchmark.component.ts index b6a3af9af..215cc15c6 100644 --- a/libs/ui/src/lib/benchmark/benchmark.component.ts +++ b/libs/ui/src/lib/benchmark/benchmark.component.ts @@ -1,16 +1,11 @@ import { ChangeDetectionStrategy, - ChangeDetectorRef, Component, Input, OnChanges } from '@angular/core'; -import { UserService } from '@ghostfolio/client/services/user/user.service'; -import { locale } from '@ghostfolio/common/config'; import { resolveMarketCondition } from '@ghostfolio/common/helper'; import { Benchmark, User } from '@ghostfolio/common/interfaces'; -import { without } from 'lodash'; -import { Subject, takeUntil } from 'rxjs'; @Component({ selector: 'gf-benchmark', @@ -21,42 +16,23 @@ import { Subject, takeUntil } from 'rxjs'; export class BenchmarkComponent implements OnChanges { @Input() benchmarks: Benchmark[]; @Input() locale: string; + @Input() user: User; public displayedColumns = ['name', 'date', 'change', 'marketCondition']; public resolveMarketCondition = resolveMarketCondition; - public user: User; - private unsubscribeSubject = new Subject(); - - public constructor( - private changeDetectorRef: ChangeDetectorRef, - private userService: UserService - ) { - this.userService.stateChanged - .pipe(takeUntil(this.unsubscribeSubject)) - .subscribe((state) => { - if (state?.user) { - this.user = state.user; - - if (this.user?.settings?.isExperimentalFeatures) { - this.displayedColumns = [ - 'name', - 'trend50d', - 'trend200d', - 'date', - 'change', - 'marketCondition' - ]; - } - - this.changeDetectorRef.markForCheck(); - } - }); - } + public constructor() {} public ngOnChanges() { - if (!this.locale) { - this.locale = locale; + if (this.user?.settings?.isExperimentalFeatures) { + this.displayedColumns = [ + 'name', + 'trend50d', + 'trend200d', + 'date', + 'change', + 'marketCondition' + ]; } } }