Browse Source

feat(client): convert historicalDataItems to signal

pull/6921/head
KenTandrian 4 days ago
parent
commit
9e03d33d9d
  1. 6
      apps/client/src/app/components/home-market/home-market.component.ts
  2. 2
      apps/client/src/app/components/home-market/home-market.html

6
apps/client/src/app/components/home-market/home-market.component.ts

@ -46,7 +46,7 @@ export class GfHomeMarketComponent implements OnInit {
protected readonly fearLabel = $localize`Fear`; protected readonly fearLabel = $localize`Fear`;
protected readonly greedLabel = $localize`Greed`; protected readonly greedLabel = $localize`Greed`;
protected hasPermissionToAccessFearAndGreedIndex: boolean; protected hasPermissionToAccessFearAndGreedIndex: boolean;
protected historicalDataItems: HistoricalDataItem[]; protected readonly historicalDataItems = signal<HistoricalDataItem[]>([]);
protected readonly numberOfDays = 365; protected readonly numberOfDays = 365;
protected user: User; protected user: User;
@ -91,13 +91,13 @@ export class GfHomeMarketComponent implements OnInit {
.pipe(takeUntilDestroyed(this.destroyRef)) .pipe(takeUntilDestroyed(this.destroyRef))
.subscribe(({ historicalData, marketPrice }) => { .subscribe(({ historicalData, marketPrice }) => {
this.fearAndGreedIndex = marketPrice; this.fearAndGreedIndex = marketPrice;
this.historicalDataItems = [ this.historicalDataItems.set([
...historicalData, ...historicalData,
{ {
date: resetHours(new Date()).toISOString(), date: resetHours(new Date()).toISOString(),
value: marketPrice value: marketPrice
} }
]; ]);
this.changeDetectorRef.markForCheck(); this.changeDetectorRef.markForCheck();
}); });

2
apps/client/src/app/components/home-market/home-market.html

@ -10,7 +10,7 @@
class="mb-3" class="mb-3"
label="Fear & Greed Index" label="Fear & Greed Index"
[colorScheme]="user?.settings?.colorScheme" [colorScheme]="user?.settings?.colorScheme"
[historicalDataItems]="historicalDataItems" [historicalDataItems]="historicalDataItems()"
[isAnimated]="true" [isAnimated]="true"
[locale]="user?.settings?.locale || undefined" [locale]="user?.settings?.locale || undefined"
[showXAxis]="true" [showXAxis]="true"

Loading…
Cancel
Save