|
|
@ -22,6 +22,7 @@ import { Title } from '@angular/platform-browser'; |
|
|
import { |
|
|
import { |
|
|
ActivatedRoute, |
|
|
ActivatedRoute, |
|
|
NavigationEnd, |
|
|
NavigationEnd, |
|
|
|
|
|
Params, |
|
|
PRIMARY_OUTLET, |
|
|
PRIMARY_OUTLET, |
|
|
Router, |
|
|
Router, |
|
|
RouterLink, |
|
|
RouterLink, |
|
|
@ -36,10 +37,15 @@ import { filter } from 'rxjs/operators'; |
|
|
import { GfFooterComponent } from './components/footer/footer.component'; |
|
|
import { GfFooterComponent } from './components/footer/footer.component'; |
|
|
import { GfHeaderComponent } from './components/header/header.component'; |
|
|
import { GfHeaderComponent } from './components/header/header.component'; |
|
|
import { GfHoldingDetailDialogComponent } from './components/holding-detail-dialog/holding-detail-dialog.component'; |
|
|
import { GfHoldingDetailDialogComponent } from './components/holding-detail-dialog/holding-detail-dialog.component'; |
|
|
import { HoldingDetailDialogParams } from './components/holding-detail-dialog/interfaces/interfaces'; |
|
|
|
|
|
import { ImpersonationStorageService } from './services/impersonation-storage.service'; |
|
|
import { ImpersonationStorageService } from './services/impersonation-storage.service'; |
|
|
import { UserService } from './services/user/user.service'; |
|
|
import { UserService } from './services/user/user.service'; |
|
|
|
|
|
|
|
|
|
|
|
export interface GfAppQueryParams extends Params { |
|
|
|
|
|
dataSource?: DataSource; |
|
|
|
|
|
holdingDetailDialog?: string; |
|
|
|
|
|
symbol?: string; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
@Component({ |
|
|
@Component({ |
|
|
changeDetection: ChangeDetectionStrategy.OnPush, |
|
|
changeDetection: ChangeDetectionStrategy.OnPush, |
|
|
imports: [GfFooterComponent, GfHeaderComponent, RouterLink, RouterOutlet], |
|
|
imports: [GfFooterComponent, GfHeaderComponent, RouterLink, RouterOutlet], |
|
|
@ -48,10 +54,6 @@ import { UserService } from './services/user/user.service'; |
|
|
templateUrl: './app.component.html' |
|
|
templateUrl: './app.component.html' |
|
|
}) |
|
|
}) |
|
|
export class GfAppComponent implements OnInit { |
|
|
export class GfAppComponent implements OnInit { |
|
|
@HostBinding('class.has-info-message') get getHasMessage() { |
|
|
|
|
|
return this.hasInfoMessage; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public canCreateAccount: boolean; |
|
|
public canCreateAccount: boolean; |
|
|
public currentRoute: string; |
|
|
public currentRoute: string; |
|
|
public currentSubRoute: string; |
|
|
public currentSubRoute: string; |
|
|
@ -66,7 +68,7 @@ export class GfAppComponent implements OnInit { |
|
|
public pageTitle: string; |
|
|
public pageTitle: string; |
|
|
public routerLinkRegister = publicRoutes.register.routerLink; |
|
|
public routerLinkRegister = publicRoutes.register.routerLink; |
|
|
public showFooter = false; |
|
|
public showFooter = false; |
|
|
public user: User; |
|
|
public user: User | undefined; |
|
|
|
|
|
|
|
|
public constructor( |
|
|
public constructor( |
|
|
private changeDetectorRef: ChangeDetectorRef, |
|
|
private changeDetectorRef: ChangeDetectorRef, |
|
|
@ -87,15 +89,12 @@ export class GfAppComponent implements OnInit { |
|
|
|
|
|
|
|
|
this.route.queryParams |
|
|
this.route.queryParams |
|
|
.pipe(takeUntilDestroyed(this.destroyRef)) |
|
|
.pipe(takeUntilDestroyed(this.destroyRef)) |
|
|
.subscribe((params) => { |
|
|
.subscribe((params: GfAppQueryParams) => { |
|
|
if ( |
|
|
const { dataSource, holdingDetailDialog, symbol } = params; |
|
|
params['dataSource'] && |
|
|
if (dataSource && holdingDetailDialog && symbol) { |
|
|
params['holdingDetailDialog'] && |
|
|
|
|
|
params['symbol'] |
|
|
|
|
|
) { |
|
|
|
|
|
this.openHoldingDetailDialog({ |
|
|
this.openHoldingDetailDialog({ |
|
|
dataSource: params['dataSource'], |
|
|
dataSource, |
|
|
symbol: params['symbol'] |
|
|
symbol |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
@ -103,6 +102,10 @@ export class GfAppComponent implements OnInit { |
|
|
addIcons({ openOutline }); |
|
|
addIcons({ openOutline }); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@HostBinding('class.has-info-message') get getHasMessage() { |
|
|
|
|
|
return this.hasInfoMessage; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
public ngOnInit() { |
|
|
public ngOnInit() { |
|
|
this.deviceType = this.deviceService.getDeviceInfo().deviceType; |
|
|
this.deviceType = this.deviceService.getDeviceInfo().deviceType; |
|
|
this.info = this.dataService.fetchInfo(); |
|
|
this.info = this.dataService.fetchInfo(); |
|
|
@ -128,7 +131,7 @@ export class GfAppComponent implements OnInit { |
|
|
!this.currentSubRoute) || |
|
|
!this.currentSubRoute) || |
|
|
(this.currentRoute === internalRoutes.home.path && |
|
|
(this.currentRoute === internalRoutes.home.path && |
|
|
this.currentSubRoute === |
|
|
this.currentSubRoute === |
|
|
internalRoutes.home.subRoutes.holdings.path) || |
|
|
internalRoutes.home.subRoutes?.holdings.path) || |
|
|
(this.currentRoute === internalRoutes.portfolio.path && |
|
|
(this.currentRoute === internalRoutes.portfolio.path && |
|
|
!this.currentSubRoute)) && |
|
|
!this.currentSubRoute)) && |
|
|
this.user?.settings?.viewMode !== 'ZEN' |
|
|
this.user?.settings?.viewMode !== 'ZEN' |
|
|
@ -223,11 +226,16 @@ export class GfAppComponent implements OnInit { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public onClickSystemMessage() { |
|
|
public onClickSystemMessage() { |
|
|
if (this.user.systemMessage.routerLink) { |
|
|
const systemMessage = this.user?.systemMessage; |
|
|
this.router.navigate(this.user.systemMessage.routerLink); |
|
|
if (!systemMessage) { |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (systemMessage.routerLink) { |
|
|
|
|
|
void this.router.navigate(systemMessage.routerLink); |
|
|
} else { |
|
|
} else { |
|
|
this.notificationService.alert({ |
|
|
this.notificationService.alert({ |
|
|
title: this.user.systemMessage.message |
|
|
title: systemMessage.message |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
@ -269,10 +277,7 @@ export class GfAppComponent implements OnInit { |
|
|
.subscribe((user) => { |
|
|
.subscribe((user) => { |
|
|
this.user = user; |
|
|
this.user = user; |
|
|
|
|
|
|
|
|
const dialogRef = this.dialog.open< |
|
|
const dialogRef = this.dialog.open(GfHoldingDetailDialogComponent, { |
|
|
GfHoldingDetailDialogComponent, |
|
|
|
|
|
HoldingDetailDialogParams |
|
|
|
|
|
>(GfHoldingDetailDialogComponent, { |
|
|
|
|
|
autoFocus: false, |
|
|
autoFocus: false, |
|
|
data: { |
|
|
data: { |
|
|
dataSource, |
|
|
dataSource, |
|
|
@ -313,7 +318,7 @@ export class GfAppComponent implements OnInit { |
|
|
.afterClosed() |
|
|
.afterClosed() |
|
|
.pipe(takeUntilDestroyed(this.destroyRef)) |
|
|
.pipe(takeUntilDestroyed(this.destroyRef)) |
|
|
.subscribe(() => { |
|
|
.subscribe(() => { |
|
|
this.router.navigate([], { |
|
|
void this.router.navigate([], { |
|
|
queryParams: { |
|
|
queryParams: { |
|
|
dataSource: null, |
|
|
dataSource: null, |
|
|
holdingDetailDialog: null, |
|
|
holdingDetailDialog: null, |
|
|
@ -339,6 +344,6 @@ export class GfAppComponent implements OnInit { |
|
|
|
|
|
|
|
|
this.document |
|
|
this.document |
|
|
.querySelector('meta[name="theme-color"]') |
|
|
.querySelector('meta[name="theme-color"]') |
|
|
.setAttribute('content', themeColor); |
|
|
?.setAttribute('content', themeColor); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|