@ -1,5 +1,6 @@
import { ImpersonationStorageService } from '@ghostfolio/client/services/impersonation-storage.service' ;
import { ImpersonationStorageService } from '@ghostfolio/client/services/impersonation-storage.service' ;
import { UserService } from '@ghostfolio/client/services/user/user.service' ;
import { UserService } from '@ghostfolio/client/services/user/user.service' ;
import { locale as defaultLocale } from '@ghostfolio/common/config' ;
import {
import {
AssetProfileIdentifier ,
AssetProfileIdentifier ,
Benchmark ,
Benchmark ,
@ -14,8 +15,10 @@ import {
ChangeDetectionStrategy ,
ChangeDetectionStrategy ,
ChangeDetectorRef ,
ChangeDetectorRef ,
Component ,
Component ,
computed ,
CUSTOM_ELEMENTS_SCHEMA ,
CUSTOM_ELEMENTS_SCHEMA ,
DestroyRef ,
DestroyRef ,
inject ,
OnInit
OnInit
} from '@angular/core' ;
} from '@angular/core' ;
import { takeUntilDestroyed } from '@angular/core/rxjs-interop' ;
import { takeUntilDestroyed } from '@angular/core/rxjs-interop' ;
@ -45,26 +48,29 @@ import { CreateWatchlistItemDialogParams } from './create-watchlist-item-dialog/
templateUrl : './home-watchlist.html'
templateUrl : './home-watchlist.html'
} )
} )
export class GfHomeWatchlistComponent implements OnInit {
export class GfHomeWatchlistComponent implements OnInit {
public deviceType : string ;
protected hasImpersonationId : boolean ;
public hasImpersonationId : boolean ;
protected hasPermissionToCreateWatchlistItem : boolean ;
public hasPermissionToCreateWatchlistItem : boolean ;
protected hasPermissionToDeleteWatchlistItem : boolean ;
public hasPermissionToDeleteWatchlistItem : boolean ;
protected user : User ;
public user : User ;
protected watchlist : Benchmark [ ] ;
public watchlist : Benchmark [ ] ;
protected readonly deviceType = computed (
public constructor (
( ) = > this . deviceDetectorService . deviceInfo ( ) . deviceType
private changeDetectorRef : ChangeDetectorRef ,
) ;
private dataService : DataService ,
private destroyRef : DestroyRef ,
private readonly changeDetectorRef = inject ( ChangeDetectorRef ) ;
private deviceService : DeviceDetectorService ,
private readonly dataService = inject ( DataService ) ;
private dialog : MatDialog ,
private readonly destroyRef = inject ( DestroyRef ) ;
private impersonationStorageService : ImpersonationStorageService ,
private readonly deviceDetectorService = inject ( DeviceDetectorService ) ;
private route : ActivatedRoute ,
private readonly dialog = inject ( MatDialog ) ;
private router : Router ,
private readonly impersonationStorageService = inject (
private userService : UserService
ImpersonationStorageService
) {
) ;
this . deviceType = this . deviceService . getDeviceInfo ( ) . deviceType ;
private readonly route = inject ( ActivatedRoute ) ;
private readonly router = inject ( Router ) ;
private readonly userService = inject ( UserService ) ;
public constructor ( ) {
this . impersonationStorageService
this . impersonationStorageService
. onChangeHasImpersonation ( )
. onChangeHasImpersonation ( )
. pipe ( takeUntilDestroyed ( this . destroyRef ) )
. pipe ( takeUntilDestroyed ( this . destroyRef ) )
@ -110,7 +116,7 @@ export class GfHomeWatchlistComponent implements OnInit {
this . loadWatchlistData ( ) ;
this . loadWatchlistData ( ) ;
}
}
public onWatchlistItemDeleted ( {
protected onWatchlistItemDeleted ( {
dataSource ,
dataSource ,
symbol
symbol
} : AssetProfileIdentifier ) {
} : AssetProfileIdentifier ) {
@ -148,10 +154,10 @@ export class GfHomeWatchlistComponent implements OnInit {
> ( GfCreateWatchlistItemDialogComponent , {
> ( GfCreateWatchlistItemDialogComponent , {
autoFocus : false ,
autoFocus : false ,
data : {
data : {
deviceType : this.deviceType ,
deviceType : this.deviceType ( ) ,
locale : this.user?.settings?.locale
locale : this.user?.settings?.locale ? ? defaultLocale
} ,
} ,
width : this.deviceType === 'mobile' ? '100vw' : '50rem'
width : this.deviceType ( ) === 'mobile' ? '100vw' : '50rem'
} ) ;
} ) ;
dialogRef
dialogRef