|
@ -1,36 +1,18 @@ |
|
|
import { |
|
|
import { ChangeDetectorRef, Component, OnDestroy, OnInit } from '@angular/core'; |
|
|
ChangeDetectorRef, |
|
|
|
|
|
Component, |
|
|
|
|
|
HostBinding, |
|
|
|
|
|
OnDestroy, |
|
|
|
|
|
OnInit |
|
|
|
|
|
} from '@angular/core'; |
|
|
|
|
|
import { DataService } from '@ghostfolio/client/services/data.service'; |
|
|
|
|
|
import { UserService } from '@ghostfolio/client/services/user/user.service'; |
|
|
import { UserService } from '@ghostfolio/client/services/user/user.service'; |
|
|
import { |
|
|
import { TabConfiguration, User } from '@ghostfolio/common/interfaces'; |
|
|
InfoItem, |
|
|
|
|
|
TabConfiguration, |
|
|
|
|
|
User |
|
|
|
|
|
} from '@ghostfolio/common/interfaces'; |
|
|
|
|
|
import { hasPermission, permissions } from '@ghostfolio/common/permissions'; |
|
|
|
|
|
import { DeviceDetectorService } from 'ngx-device-detector'; |
|
|
import { DeviceDetectorService } from 'ngx-device-detector'; |
|
|
import { Subject } from 'rxjs'; |
|
|
import { Subject } from 'rxjs'; |
|
|
import { takeUntil } from 'rxjs/operators'; |
|
|
import { takeUntil } from 'rxjs/operators'; |
|
|
|
|
|
|
|
|
@Component({ |
|
|
@Component({ |
|
|
host: { class: 'page with-tabs' }, |
|
|
host: { class: 'page has-tabs' }, |
|
|
selector: 'gf-portfolio-page', |
|
|
selector: 'gf-portfolio-page', |
|
|
styleUrls: ['./portfolio-page.scss'], |
|
|
styleUrls: ['./portfolio-page.scss'], |
|
|
templateUrl: './portfolio-page.html' |
|
|
templateUrl: './portfolio-page.html' |
|
|
}) |
|
|
}) |
|
|
export class PortfolioPageComponent implements OnDestroy, OnInit { |
|
|
export class PortfolioPageComponent implements OnDestroy, OnInit { |
|
|
@HostBinding('class.with-info-message') get getHasMessage() { |
|
|
|
|
|
return this.hasMessage; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public deviceType: string; |
|
|
public deviceType: string; |
|
|
public hasMessage: boolean; |
|
|
|
|
|
public info: InfoItem; |
|
|
|
|
|
public tabs: TabConfiguration[] = []; |
|
|
public tabs: TabConfiguration[] = []; |
|
|
public user: User; |
|
|
public user: User; |
|
|
|
|
|
|
|
@ -38,12 +20,9 @@ export class PortfolioPageComponent implements OnDestroy, OnInit { |
|
|
|
|
|
|
|
|
public constructor( |
|
|
public constructor( |
|
|
private changeDetectorRef: ChangeDetectorRef, |
|
|
private changeDetectorRef: ChangeDetectorRef, |
|
|
private dataService: DataService, |
|
|
|
|
|
private deviceService: DeviceDetectorService, |
|
|
private deviceService: DeviceDetectorService, |
|
|
private userService: UserService |
|
|
private userService: UserService |
|
|
) { |
|
|
) { |
|
|
this.info = this.dataService.fetchInfo(); |
|
|
|
|
|
|
|
|
|
|
|
this.userService.stateChanged |
|
|
this.userService.stateChanged |
|
|
.pipe(takeUntil(this.unsubscribeSubject)) |
|
|
.pipe(takeUntil(this.unsubscribeSubject)) |
|
|
.subscribe((state) => { |
|
|
.subscribe((state) => { |
|
@ -77,12 +56,6 @@ export class PortfolioPageComponent implements OnDestroy, OnInit { |
|
|
]; |
|
|
]; |
|
|
this.user = state.user; |
|
|
this.user = state.user; |
|
|
|
|
|
|
|
|
this.hasMessage = |
|
|
|
|
|
hasPermission( |
|
|
|
|
|
this.user?.permissions, |
|
|
|
|
|
permissions.createUserAccount |
|
|
|
|
|
) || !!this.info.systemMessage; |
|
|
|
|
|
|
|
|
|
|
|
this.changeDetectorRef.markForCheck(); |
|
|
this.changeDetectorRef.markForCheck(); |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|