Browse Source

feat(client): replaced deprecated getDeviceInfo

pull/6746/head
KenTandrian 4 days ago
parent
commit
b9097df3ed
  1. 10
      apps/client/src/app/pages/public/public-page.component.ts
  2. 4
      apps/client/src/app/pages/public/public-page.html

10
apps/client/src/app/pages/public/public-page.component.ts

@ -19,6 +19,7 @@ import { HttpErrorResponse } from '@angular/common/http';
import { import {
ChangeDetectorRef, ChangeDetectorRef,
Component, Component,
computed,
CUSTOM_ELEMENTS_SCHEMA, CUSTOM_ELEMENTS_SCHEMA,
DestroyRef, DestroyRef,
inject, inject,
@ -61,7 +62,6 @@ export class GfPublicPageComponent implements OnInit {
[code: string]: { name: string; value: number }; [code: string]: { name: string; value: number };
}; };
public defaultAlias = $localize`someone`; public defaultAlias = $localize`someone`;
public deviceType: string;
public hasPermissionForSubscription: boolean; public hasPermissionForSubscription: boolean;
public holdings: PublicPortfolioResponse['holdings'][string][]; public holdings: PublicPortfolioResponse['holdings'][string][];
public info: InfoItem; public info: InfoItem;
@ -86,11 +86,15 @@ export class GfPublicPageComponent implements OnInit {
}; };
public UNKNOWN_KEY = UNKNOWN_KEY; public UNKNOWN_KEY = UNKNOWN_KEY;
protected readonly deviceType = computed(
() => this.deviceDetectorService.deviceInfo().deviceType
);
private readonly activatedRoute = inject(ActivatedRoute); private readonly activatedRoute = inject(ActivatedRoute);
private readonly changeDetectorRef = inject(ChangeDetectorRef); private readonly changeDetectorRef = inject(ChangeDetectorRef);
private readonly dataService = inject(DataService); private readonly dataService = inject(DataService);
private readonly destroyRef = inject(DestroyRef); private readonly destroyRef = inject(DestroyRef);
private readonly deviceService = inject(DeviceDetectorService); private readonly deviceDetectorService = inject(DeviceDetectorService);
private readonly router = inject(Router); private readonly router = inject(Router);
private accessId: string; private accessId: string;
@ -109,8 +113,6 @@ export class GfPublicPageComponent implements OnInit {
} }
public ngOnInit() { public ngOnInit() {
this.deviceType = this.deviceService.getDeviceInfo().deviceType;
this.dataService this.dataService
.fetchPublicPortfolio(this.accessId) .fetchPublicPortfolio(this.accessId)
.pipe( .pipe(

4
apps/client/src/app/pages/public/public-page.html

@ -75,7 +75,7 @@
[data]="symbols" [data]="symbols"
[isInPercentage]="true" [isInPercentage]="true"
[keys]="['symbol']" [keys]="['symbol']"
[showLabels]="deviceType !== 'mobile'" [showLabels]="deviceType() !== 'mobile'"
/> />
<gf-holdings-table <gf-holdings-table
[hasPermissionToOpenDetails]="false" [hasPermissionToOpenDetails]="false"
@ -213,7 +213,7 @@
<mat-card-content> <mat-card-content>
<gf-activities-table <gf-activities-table
[dataSource]="latestActivitiesDataSource" [dataSource]="latestActivitiesDataSource"
[deviceType]="deviceType" [deviceType]="deviceType()"
[hasPermissionToCreateActivity]="false" [hasPermissionToCreateActivity]="false"
[hasPermissionToDeleteActivity]="false" [hasPermissionToDeleteActivity]="false"
[hasPermissionToExportActivities]="false" [hasPermissionToExportActivities]="false"

Loading…
Cancel
Save