|
|
@ -74,65 +74,50 @@ import { catchError } from 'rxjs/operators'; |
|
|
styleUrls: ['./header.component.scss'] |
|
|
styleUrls: ['./header.component.scss'] |
|
|
}) |
|
|
}) |
|
|
export class GfHeaderComponent implements OnChanges { |
|
|
export class GfHeaderComponent implements OnChanges { |
|
|
@HostListener('window:keydown', ['$event']) |
|
|
@Input() public currentRoute: string; |
|
|
openAssistantWithHotKey(event: KeyboardEvent) { |
|
|
@Input() public deviceType: string; |
|
|
if ( |
|
|
@Input() public hasPermissionToChangeDateRange: boolean; |
|
|
event.key === '/' && |
|
|
@Input() public hasPermissionToChangeFilters: boolean; |
|
|
event.target instanceof Element && |
|
|
@Input() public hasPromotion: boolean; |
|
|
event.target?.nodeName?.toLowerCase() !== 'input' && |
|
|
@Input() public hasTabs: boolean; |
|
|
event.target?.nodeName?.toLowerCase() !== 'textarea' && |
|
|
@Input() public info: InfoItem; |
|
|
this.hasPermissionToAccessAssistant |
|
|
@Input() public pageTitle: string; |
|
|
) { |
|
|
@Input() public user: User; |
|
|
this.assistantElement.setIsOpen(true); |
|
|
|
|
|
this.assistentMenuTriggerElement.openMenu(); |
|
|
@Output() public signOut = new EventEmitter<void>(); |
|
|
|
|
|
|
|
|
event.preventDefault(); |
|
|
@ViewChild('assistant') protected assistantElement: GfAssistantComponent; |
|
|
} |
|
|
@ViewChild('assistantTrigger') |
|
|
} |
|
|
protected assistentMenuTriggerElement: MatMenuTrigger; |
|
|
|
|
|
|
|
|
@Input() currentRoute: string; |
|
|
protected hasFilters: boolean; |
|
|
@Input() deviceType: string; |
|
|
protected hasImpersonationId: boolean; |
|
|
@Input() hasPermissionToChangeDateRange: boolean; |
|
|
protected hasPermissionForAuthGoogle: boolean; |
|
|
@Input() hasPermissionToChangeFilters: boolean; |
|
|
protected hasPermissionForAuthOidc: boolean; |
|
|
@Input() hasPromotion: boolean; |
|
|
protected hasPermissionForAuthToken: boolean; |
|
|
@Input() hasTabs: boolean; |
|
|
protected hasPermissionForSubscription: boolean; |
|
|
@Input() info: InfoItem; |
|
|
protected hasPermissionToAccessAdminControl: boolean; |
|
|
@Input() pageTitle: string; |
|
|
protected hasPermissionToAccessAssistant: boolean; |
|
|
@Input() user: User; |
|
|
protected hasPermissionToAccessFearAndGreedIndex: boolean; |
|
|
|
|
|
protected hasPermissionToCreateUser: boolean; |
|
|
@Output() signOut = new EventEmitter<void>(); |
|
|
protected impersonationId: string; |
|
|
|
|
|
protected internalRoutes = internalRoutes; |
|
|
@ViewChild('assistant') assistantElement: GfAssistantComponent; |
|
|
protected isMenuOpen: boolean; |
|
|
@ViewChild('assistantTrigger') assistentMenuTriggerElement: MatMenuTrigger; |
|
|
protected routeAbout = publicRoutes.about.path; |
|
|
|
|
|
protected routeFeatures = publicRoutes.features.path; |
|
|
public hasFilters: boolean; |
|
|
protected routeMarkets = publicRoutes.markets.path; |
|
|
public hasImpersonationId: boolean; |
|
|
protected routePricing = publicRoutes.pricing.path; |
|
|
public hasPermissionForAuthGoogle: boolean; |
|
|
protected routeResources = publicRoutes.resources.path; |
|
|
public hasPermissionForAuthOidc: boolean; |
|
|
protected routerLinkAbout = publicRoutes.about.routerLink; |
|
|
public hasPermissionForAuthToken: boolean; |
|
|
protected routerLinkAccount = internalRoutes.account.routerLink; |
|
|
public hasPermissionForSubscription: boolean; |
|
|
protected routerLinkAccounts = internalRoutes.accounts.routerLink; |
|
|
public hasPermissionToAccessAdminControl: boolean; |
|
|
protected routerLinkAdminControl = internalRoutes.adminControl.routerLink; |
|
|
public hasPermissionToAccessAssistant: boolean; |
|
|
protected routerLinkFeatures = publicRoutes.features.routerLink; |
|
|
public hasPermissionToAccessFearAndGreedIndex: boolean; |
|
|
protected routerLinkMarkets = publicRoutes.markets.routerLink; |
|
|
public hasPermissionToCreateUser: boolean; |
|
|
protected routerLinkPortfolio = internalRoutes.portfolio.routerLink; |
|
|
public impersonationId: string; |
|
|
protected routerLinkPricing = publicRoutes.pricing.routerLink; |
|
|
public internalRoutes = internalRoutes; |
|
|
protected routerLinkRegister = publicRoutes.register.routerLink; |
|
|
public isMenuOpen: boolean; |
|
|
protected routerLinkResources = publicRoutes.resources.routerLink; |
|
|
public routeAbout = publicRoutes.about.path; |
|
|
|
|
|
public routeFeatures = publicRoutes.features.path; |
|
|
|
|
|
public routeMarkets = publicRoutes.markets.path; |
|
|
|
|
|
public routePricing = publicRoutes.pricing.path; |
|
|
|
|
|
public routeResources = publicRoutes.resources.path; |
|
|
|
|
|
public routerLinkAbout = publicRoutes.about.routerLink; |
|
|
|
|
|
public routerLinkAccount = internalRoutes.account.routerLink; |
|
|
|
|
|
public routerLinkAccounts = internalRoutes.accounts.routerLink; |
|
|
|
|
|
public routerLinkAdminControl = internalRoutes.adminControl.routerLink; |
|
|
|
|
|
public routerLinkFeatures = publicRoutes.features.routerLink; |
|
|
|
|
|
public routerLinkMarkets = publicRoutes.markets.routerLink; |
|
|
|
|
|
public routerLinkPortfolio = internalRoutes.portfolio.routerLink; |
|
|
|
|
|
public routerLinkPricing = publicRoutes.pricing.routerLink; |
|
|
|
|
|
public routerLinkRegister = publicRoutes.register.routerLink; |
|
|
|
|
|
public routerLinkResources = publicRoutes.resources.routerLink; |
|
|
|
|
|
|
|
|
|
|
|
public constructor( |
|
|
public constructor( |
|
|
private dataService: DataService, |
|
|
private dataService: DataService, |
|
|
@ -165,6 +150,22 @@ export class GfHeaderComponent implements OnChanges { |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@HostListener('window:keydown', ['$event']) |
|
|
|
|
|
protected openAssistantWithHotKey(event: KeyboardEvent) { |
|
|
|
|
|
if ( |
|
|
|
|
|
event.key === '/' && |
|
|
|
|
|
event.target instanceof Element && |
|
|
|
|
|
event.target?.nodeName?.toLowerCase() !== 'input' && |
|
|
|
|
|
event.target?.nodeName?.toLowerCase() !== 'textarea' && |
|
|
|
|
|
this.hasPermissionToAccessAssistant |
|
|
|
|
|
) { |
|
|
|
|
|
this.assistantElement.setIsOpen(true); |
|
|
|
|
|
this.assistentMenuTriggerElement.openMenu(); |
|
|
|
|
|
|
|
|
|
|
|
event.preventDefault(); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
public ngOnChanges() { |
|
|
public ngOnChanges() { |
|
|
this.hasFilters = this.userService.hasFilters(); |
|
|
this.hasFilters = this.userService.hasFilters(); |
|
|
|
|
|
|
|
|
@ -209,11 +210,11 @@ export class GfHeaderComponent implements OnChanges { |
|
|
); |
|
|
); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public closeAssistant() { |
|
|
protected closeAssistant() { |
|
|
this.assistentMenuTriggerElement?.closeMenu(); |
|
|
this.assistentMenuTriggerElement?.closeMenu(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public impersonateAccount(aId: string) { |
|
|
protected impersonateAccount(aId: string) { |
|
|
if (aId) { |
|
|
if (aId) { |
|
|
this.impersonationStorageService.setId(aId); |
|
|
this.impersonationStorageService.setId(aId); |
|
|
} else { |
|
|
} else { |
|
|
@ -223,7 +224,7 @@ export class GfHeaderComponent implements OnChanges { |
|
|
window.location.reload(); |
|
|
window.location.reload(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public onDateRangeChange(dateRange: DateRange) { |
|
|
protected onDateRangeChange(dateRange: DateRange) { |
|
|
this.dataService |
|
|
this.dataService |
|
|
.putUserSetting({ dateRange }) |
|
|
.putUserSetting({ dateRange }) |
|
|
.pipe(takeUntilDestroyed(this.destroyRef)) |
|
|
.pipe(takeUntilDestroyed(this.destroyRef)) |
|
|
@ -235,7 +236,7 @@ export class GfHeaderComponent implements OnChanges { |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public onFiltersChanged(filters: Filter[]) { |
|
|
protected onFiltersChanged(filters: Filter[]) { |
|
|
const userSetting: UpdateUserSettingDto = {}; |
|
|
const userSetting: UpdateUserSettingDto = {}; |
|
|
|
|
|
|
|
|
for (const filter of filters) { |
|
|
for (const filter of filters) { |
|
|
@ -263,29 +264,29 @@ export class GfHeaderComponent implements OnChanges { |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public onLogoClick() { |
|
|
protected onLogoClick() { |
|
|
if (['home', 'zen'].includes(this.currentRoute)) { |
|
|
if (['home', 'zen'].includes(this.currentRoute)) { |
|
|
this.layoutService.getShouldReloadSubject().next(); |
|
|
this.layoutService.getShouldReloadSubject().next(); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public onMenuClosed() { |
|
|
protected onMenuClosed() { |
|
|
this.isMenuOpen = false; |
|
|
this.isMenuOpen = false; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public onMenuOpened() { |
|
|
protected onMenuOpened() { |
|
|
this.isMenuOpen = true; |
|
|
this.isMenuOpen = true; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public onOpenAssistant() { |
|
|
protected onOpenAssistant() { |
|
|
this.assistantElement.initialize(); |
|
|
this.assistantElement.initialize(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public onSignOut() { |
|
|
protected onSignOut() { |
|
|
this.signOut.next(); |
|
|
this.signOut.next(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public openLoginDialog() { |
|
|
protected openLoginDialog() { |
|
|
const dialogRef = this.dialog.open< |
|
|
const dialogRef = this.dialog.open< |
|
|
GfLoginWithAccessTokenDialogComponent, |
|
|
GfLoginWithAccessTokenDialogComponent, |
|
|
LoginWithAccessTokenDialogParams, |
|
|
LoginWithAccessTokenDialogParams, |
|
|
@ -326,7 +327,7 @@ export class GfHeaderComponent implements OnChanges { |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public setToken(aToken: string) { |
|
|
private setToken(aToken: string) { |
|
|
this.tokenStorageService.saveToken( |
|
|
this.tokenStorageService.saveToken( |
|
|
aToken, |
|
|
aToken, |
|
|
this.settingsStorageService.getSetting(KEY_STAY_SIGNED_IN) === 'true' |
|
|
this.settingsStorageService.getSetting(KEY_STAY_SIGNED_IN) === 'true' |
|
|
|