Browse Source

feat(client): resolve errors

pull/6927/head
KenTandrian 2 days ago
parent
commit
01103ba015
  1. 26
      apps/client/src/app/components/home-overview/home-overview.component.ts

26
apps/client/src/app/components/home-overview/home-overview.component.ts

@ -3,6 +3,7 @@ import { LayoutService } from '@ghostfolio/client/core/layout.service';
import { ImpersonationStorageService } from '@ghostfolio/client/services/impersonation-storage.service'; import { ImpersonationStorageService } from '@ghostfolio/client/services/impersonation-storage.service';
import { UserService } from '@ghostfolio/client/services/user/user.service'; import { UserService } from '@ghostfolio/client/services/user/user.service';
import { import {
DEFAULT_CURRENCY,
DEFAULT_DATE_RANGE, DEFAULT_DATE_RANGE,
NUMERICAL_PRECISION_THRESHOLD_6_FIGURES NUMERICAL_PRECISION_THRESHOLD_6_FIGURES
} from '@ghostfolio/common/config'; } from '@ghostfolio/common/config';
@ -47,7 +48,7 @@ export class GfHomeOverviewComponent implements OnInit {
public hasError: boolean; public hasError: boolean;
public hasImpersonationId: boolean; public hasImpersonationId: boolean;
public hasPermissionToCreateActivity: boolean; public hasPermissionToCreateActivity: boolean;
public historicalDataItems: LineChartItem[]; public historicalDataItems: LineChartItem[] | null;
public isAllTimeHigh: boolean; public isAllTimeHigh: boolean;
public isAllTimeLow: boolean; public isAllTimeLow: boolean;
public isLoadingPerformance = true; public isLoadingPerformance = true;
@ -94,7 +95,9 @@ export class GfHomeOverviewComponent implements OnInit {
!this.user.settings.isRestrictedView && !this.user.settings.isRestrictedView &&
this.user.settings.viewMode !== 'ZEN'; this.user.settings.viewMode !== 'ZEN';
this.unit = this.showDetails ? this.user.settings.baseCurrency : '%'; this.unit = this.showDetails
? (this.user.settings.baseCurrency ?? DEFAULT_CURRENCY)
: '%';
this.impersonationStorageService this.impersonationStorageService
.onChangeHasImpersonation() .onChangeHasImpersonation()
@ -122,17 +125,18 @@ export class GfHomeOverviewComponent implements OnInit {
}) })
.pipe(takeUntilDestroyed(this.destroyRef)) .pipe(takeUntilDestroyed(this.destroyRef))
.subscribe(({ chart, errors, performance }) => { .subscribe(({ chart, errors, performance }) => {
this.errors = errors; this.errors = errors ?? [];
this.performance = performance; this.performance = performance;
this.historicalDataItems = chart.map( this.historicalDataItems =
({ date, netPerformanceInPercentageWithCurrencyEffect }) => { chart?.map(
return { ({ date, netPerformanceInPercentageWithCurrencyEffect }) => {
date, return {
value: netPerformanceInPercentageWithCurrencyEffect * 100 date,
}; value: (netPerformanceInPercentageWithCurrencyEffect ?? 0) * 100
} };
); }
) ?? null;
if ( if (
this.deviceType === 'mobile' && this.deviceType === 'mobile' &&

Loading…
Cancel
Save