Browse Source

feat(client): replace deprecated getDeviceInfo

pull/6927/head
KenTandrian 2 days ago
parent
commit
07245753e2
  1. 10
      apps/client/src/app/components/home-overview/home-overview.component.ts
  2. 4
      apps/client/src/app/components/home-overview/home-overview.html

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

@ -21,6 +21,7 @@ import { DataService } from '@ghostfolio/ui/services';
import { import {
ChangeDetectorRef, ChangeDetectorRef,
Component, Component,
computed,
DestroyRef, DestroyRef,
inject, inject,
OnInit OnInit
@ -42,7 +43,10 @@ import { DeviceDetectorService } from 'ngx-device-detector';
templateUrl: './home-overview.html' templateUrl: './home-overview.html'
}) })
export class GfHomeOverviewComponent implements OnInit { export class GfHomeOverviewComponent implements OnInit {
protected deviceType: string; protected readonly deviceType = computed(
() => this.deviceDetectorService.deviceInfo().deviceType
);
protected errors: AssetProfileIdentifier[]; protected errors: AssetProfileIdentifier[];
protected hasImpersonationId: boolean; protected hasImpersonationId: boolean;
protected hasPermissionToCreateActivity: boolean; protected hasPermissionToCreateActivity: boolean;
@ -87,8 +91,6 @@ export class GfHomeOverviewComponent implements OnInit {
} }
public ngOnInit() { public ngOnInit() {
this.deviceType = this.deviceDetectorService.getDeviceInfo().deviceType;
this.showDetails = this.showDetails =
!this.user.settings.isRestrictedView && !this.user.settings.isRestrictedView &&
this.user.settings.viewMode !== 'ZEN'; this.user.settings.viewMode !== 'ZEN';
@ -137,7 +139,7 @@ export class GfHomeOverviewComponent implements OnInit {
) ?? null; ) ?? null;
if ( if (
this.deviceType === 'mobile' && this.deviceType() === 'mobile' &&
this.performance.currentValueInBaseCurrency >= this.performance.currentValueInBaseCurrency >=
NUMERICAL_PRECISION_THRESHOLD_6_FIGURES NUMERICAL_PRECISION_THRESHOLD_6_FIGURES
) { ) {

4
apps/client/src/app/components/home-overview/home-overview.html

@ -67,7 +67,7 @@
<gf-line-chart <gf-line-chart
class="position-absolute" class="position-absolute"
unit="%" unit="%"
[class.pr-3]="deviceType === 'mobile'" [class.pr-3]="deviceType() === 'mobile'"
[colorScheme]="user?.settings?.colorScheme" [colorScheme]="user?.settings?.colorScheme"
[hidden]="historicalDataItems?.length === 0" [hidden]="historicalDataItems?.length === 0"
[historicalDataItems]="historicalDataItems" [historicalDataItems]="historicalDataItems"
@ -86,7 +86,7 @@
<div class="col"> <div class="col">
<gf-portfolio-performance <gf-portfolio-performance
class="pb-4" class="pb-4"
[deviceType]="deviceType" [deviceType]="deviceType()"
[errors]="errors" [errors]="errors"
[isLoading]="isLoadingPerformance" [isLoading]="isLoadingPerformance"
[locale]="user?.settings?.locale" [locale]="user?.settings?.locale"

Loading…
Cancel
Save