Browse Source

feat(client): replace deprecated getDeviceInfo

pull/6934/head
KenTandrian 2 days ago
parent
commit
d0e84a9be7
  1. 15
      apps/client/src/app/components/user-account-access/user-account-access.component.ts

15
apps/client/src/app/components/user-account-access/user-account-access.component.ts

@ -12,6 +12,7 @@ import {
ChangeDetectionStrategy, ChangeDetectionStrategy,
ChangeDetectorRef, ChangeDetectorRef,
Component, Component,
computed,
CUSTOM_ELEMENTS_SCHEMA, CUSTOM_ELEMENTS_SCHEMA,
DestroyRef, DestroyRef,
inject, inject,
@ -73,7 +74,9 @@ export class GfUserAccountAccessComponent implements OnInit {
}); });
protected user: User; protected user: User;
private deviceType: string; private readonly deviceType = computed(
() => this.deviceDetectorService.deviceInfo().deviceType
);
private readonly changeDetectorRef = inject(ChangeDetectorRef); private readonly changeDetectorRef = inject(ChangeDetectorRef);
private readonly dataService = inject(DataService); private readonly dataService = inject(DataService);
@ -132,8 +135,6 @@ export class GfUserAccountAccessComponent implements OnInit {
} }
public ngOnInit() { public ngOnInit() {
this.deviceType = this.deviceDetectorService.getDeviceInfo().deviceType;
this.update(); this.update();
} }
@ -195,8 +196,8 @@ export class GfUserAccountAccessComponent implements OnInit {
CreateOrUpdateAccessDialogParams CreateOrUpdateAccessDialogParams
>(GfCreateOrUpdateAccessDialogComponent, { >(GfCreateOrUpdateAccessDialogComponent, {
data: {} satisfies CreateOrUpdateAccessDialogParams, data: {} satisfies CreateOrUpdateAccessDialogParams,
height: this.deviceType === 'mobile' ? '98vh' : undefined, height: this.deviceType() === 'mobile' ? '98vh' : undefined,
width: this.deviceType === 'mobile' ? '100vw' : '50rem' width: this.deviceType() === 'mobile' ? '100vw' : '50rem'
}); });
dialogRef.afterClosed().subscribe((access: CreateAccessDto | null) => { dialogRef.afterClosed().subscribe((access: CreateAccessDto | null) => {
@ -230,8 +231,8 @@ export class GfUserAccountAccessComponent implements OnInit {
type: access.type type: access.type
} }
} satisfies CreateOrUpdateAccessDialogParams, } satisfies CreateOrUpdateAccessDialogParams,
height: this.deviceType === 'mobile' ? '98vh' : undefined, height: this.deviceType() === 'mobile' ? '98vh' : undefined,
width: this.deviceType === 'mobile' ? '100vw' : '50rem' width: this.deviceType() === 'mobile' ? '100vw' : '50rem'
}); });
dialogRef.afterClosed().subscribe((result) => { dialogRef.afterClosed().subscribe((result) => {

Loading…
Cancel
Save