From 4da20fb9e73b05292c744c2e3f00aa6a7a29ac35 Mon Sep 17 00:00:00 2001 From: MishaZhem Date: Thu, 29 Aug 2024 12:35:24 +0300 Subject: [PATCH] chore: change checker --- .../prices/price-chart/price-chart.component.html | 2 +- .../prices/price-chart/price-chart.component.ts | 12 ++++-------- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/apps/taiga-lumbermill/src/dashboards/crypto/components/prices/price-chart/price-chart.component.html b/apps/taiga-lumbermill/src/dashboards/crypto/components/prices/price-chart/price-chart.component.html index 6e5d8fc21..04b91024e 100644 --- a/apps/taiga-lumbermill/src/dashboards/crypto/components/prices/price-chart/price-chart.component.html +++ b/apps/taiga-lumbermill/src/dashboards/crypto/components/prices/price-chart/price-chart.component.html @@ -4,7 +4,7 @@ [horizontalLines]="4" [verticalLines]="4" > - @if (checkInfinity(maxPrice()) && checkInfinity(minPrice())) { + @if (history()) { this.processData(this.history())); - protected minPrice = computed( - () => Math.min(...(this.history() ?? []).map((val) => Number(val.priceUsd))) || 0, + protected minPrice = computed(() => + Math.min(...(this.history() ?? []).map((val) => Number(val.priceUsd))), ); - protected maxPrice = computed( - () => Math.max(...(this.history() ?? []).map((val) => Number(val.priceUsd))) || 0, + protected maxPrice = computed(() => + Math.max(...(this.history() ?? []).map((val) => Number(val.priceUsd))), ); protected filterButtons = ['D', 'W', 'M', 'M6', 'Y']; @@ -94,10 +94,6 @@ export class PriceChartComponent { return fullSize.filter((_, i) => i % this.step() === 0); } - protected checkInfinity(value: number): boolean { - return Number.isFinite(value); - } - protected readonly yStringify: TuiStringHandler = (y) => `${(this.maxPrice() > 10 ? y : y / 100).toLocaleString('en-US', {maximumFractionDigits: this.maxPrice() > 10 ? 0 : 2})} $`;