From 67c73d40f0b5514a1ae6f57223563e41ea718371 Mon Sep 17 00:00:00 2001 From: KenTandrian Date: Sat, 20 Jun 2026 12:23:06 +0700 Subject: [PATCH] feat(client): replace deprecated getDeviceInfo --- .../allocations/allocations-page.component.ts | 13 +++++++------ .../portfolio/allocations/allocations-page.html | 2 +- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/apps/client/src/app/pages/portfolio/allocations/allocations-page.component.ts b/apps/client/src/app/pages/portfolio/allocations/allocations-page.component.ts index 347953269..2c3b7a33d 100644 --- a/apps/client/src/app/pages/portfolio/allocations/allocations-page.component.ts +++ b/apps/client/src/app/pages/portfolio/allocations/allocations-page.component.ts @@ -24,6 +24,7 @@ import { GfWorldMapChartComponent } from '@ghostfolio/ui/world-map-chart'; import { ChangeDetectorRef, Component, + computed, DestroyRef, inject, OnInit @@ -72,7 +73,9 @@ export class GfAllocationsPageComponent implements OnInit { protected countries: { [code: string]: { name: string; value: number }; }; - protected deviceType: string; + protected readonly deviceType = computed( + () => this.deviceDetectorService.deviceInfo().deviceType + ); protected hasImpersonationId: boolean; protected holdings: { [symbol: string]: Pick< @@ -145,8 +148,6 @@ export class GfAllocationsPageComponent implements OnInit { } public ngOnInit() { - this.deviceType = this.deviceDetectorService.getDeviceInfo().deviceType; - this.impersonationStorageService .onChangeHasImpersonation() .pipe(takeUntilDestroyed(this.destroyRef)) @@ -599,15 +600,15 @@ export class GfAllocationsPageComponent implements OnInit { autoFocus: false, data: { accountId: aAccountId, - deviceType: this.deviceType, + deviceType: this.deviceType(), hasImpersonationId: this.hasImpersonationId, hasPermissionToCreateActivity: !this.hasImpersonationId && hasPermission(this.user?.permissions, permissions.createActivity) && !this.user?.settings?.isRestrictedView }, - height: this.deviceType === 'mobile' ? '98vh' : '80vh', - width: this.deviceType === 'mobile' ? '100vw' : '50rem' + height: this.deviceType() === 'mobile' ? '98vh' : '80vh', + width: this.deviceType() === 'mobile' ? '100vw' : '50rem' }); dialogRef diff --git a/apps/client/src/app/pages/portfolio/allocations/allocations-page.html b/apps/client/src/app/pages/portfolio/allocations/allocations-page.html index a1000189b..d5c765958 100644 --- a/apps/client/src/app/pages/portfolio/allocations/allocations-page.html +++ b/apps/client/src/app/pages/portfolio/allocations/allocations-page.html @@ -115,7 +115,7 @@ [isInPercentage]="showValuesInPercentage()" [keys]="['symbol']" [locale]="user?.settings?.locale" - [showLabels]="deviceType !== 'mobile'" + [showLabels]="deviceType() !== 'mobile'" (proportionChartClicked)="onSymbolChartClicked($event)" />