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

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

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

Loading…
Cancel
Save