Browse Source

feat(client): replace deprecated getDeviceInfo

pull/6892/head
KenTandrian 1 week ago
parent
commit
895611e063
  1. 18
      apps/client/src/app/components/admin-platform/admin-platform.component.ts

18
apps/client/src/app/components/admin-platform/admin-platform.component.ts

@ -11,6 +11,7 @@ import {
ChangeDetectionStrategy, ChangeDetectionStrategy,
ChangeDetectorRef, ChangeDetectorRef,
Component, Component,
computed,
DestroyRef, DestroyRef,
inject, inject,
Input, Input,
@ -58,10 +59,13 @@ export class GfAdminPlatformComponent implements OnInit {
@Input() locale = getLocale(); @Input() locale = getLocale();
public dataSource = new MatTableDataSource<Platform>(); public dataSource = new MatTableDataSource<Platform>();
public deviceType: string;
public displayedColumns = ['name', 'url', 'accounts', 'actions'];
public platforms: Platform[]; public platforms: Platform[];
protected readonly displayedColumns = ['name', 'url', 'accounts', 'actions'];
private readonly deviceType = computed(
() => this.deviceDetectorService.deviceInfo().deviceType
);
private readonly sort = viewChild.required(MatSort); private readonly sort = viewChild.required(MatSort);
private readonly adminService = inject(AdminService); private readonly adminService = inject(AdminService);
@ -100,8 +104,6 @@ export class GfAdminPlatformComponent implements OnInit {
} }
public ngOnInit() { public ngOnInit() {
this.deviceType = this.deviceDetectorService.getDeviceInfo().deviceType;
this.fetchPlatforms(); this.fetchPlatforms();
} }
@ -160,8 +162,8 @@ export class GfAdminPlatformComponent implements OnInit {
CreateOrUpdatePlatformDialogParams CreateOrUpdatePlatformDialogParams
>(GfCreateOrUpdatePlatformDialogComponent, { >(GfCreateOrUpdatePlatformDialogComponent, {
data: {} satisfies CreateOrUpdatePlatformDialogParams, data: {} satisfies CreateOrUpdatePlatformDialogParams,
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 dialogRef
@ -200,8 +202,8 @@ export class GfAdminPlatformComponent implements OnInit {
url url
} }
} satisfies CreateOrUpdatePlatformDialogParams, } satisfies CreateOrUpdatePlatformDialogParams,
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 dialogRef

Loading…
Cancel
Save