Browse Source

feat(client): convert fearAndGreedIndex to signal

pull/6921/head
KenTandrian 4 days ago
parent
commit
4d84aa0e35
  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

@ -42,7 +42,7 @@ export class GfHomeMarketComponent implements OnInit {
protected readonly deviceType = computed(
() => this.deviceDetectorService.deviceInfo().deviceType
);
protected fearAndGreedIndex: number;
protected readonly fearAndGreedIndex = signal<number | undefined>(undefined);
protected readonly fearLabel = $localize`Fear`;
protected readonly greedLabel = $localize`Greed`;
protected hasPermissionToAccessFearAndGreedIndex: boolean;
@ -90,7 +90,7 @@ export class GfHomeMarketComponent implements OnInit {
})
.pipe(takeUntilDestroyed(this.destroyRef))
.subscribe(({ historicalData, marketPrice }) => {
this.fearAndGreedIndex = marketPrice;
this.fearAndGreedIndex.set(marketPrice);
this.historicalDataItems.set([
...historicalData,
{
@ -98,8 +98,6 @@ export class GfHomeMarketComponent implements OnInit {
value: marketPrice
}
]);
this.changeDetectorRef.markForCheck();
});
}

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

@ -22,7 +22,7 @@
/>
<gf-fear-and-greed-index
class="d-flex justify-content-center"
[fearAndGreedIndex]="fearAndGreedIndex"
[fearAndGreedIndex]="fearAndGreedIndex()"
/>
</div>
</div>

Loading…
Cancel
Save