1 import { Component, Input, OnInit } from '@angular/core';
3 import { NbMenuService, NbSidebarService } from '@nebular/theme';
5 import { UserService } from '../../../@core-xds/services/users.service';
6 import { AnalyticsService } from '../../../@core/utils/analytics.service';
8 import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
9 import { AboutModalComponent } from '../../../pages/about/about-modal/about-modal.component';
12 selector: 'ngx-header',
13 styleUrls: ['./header.component.scss'],
14 templateUrl: './header.component.html',
16 export class HeaderComponent implements OnInit {
19 @Input() position = 'normal';
23 userMenu = [{ title: 'Profile' }, { title: 'Log out' }];
25 // XDS_MODS - FIXME: better to define own XDS component instead of reuse nb-user
29 title: 'Online XDS documentation',
31 url: 'http://docs.automotivelinux.org/docs/devguides/en/dev/#xcross-development-system-user\'s-guide',
36 constructor(private sidebarService: NbSidebarService,
37 private menuService: NbMenuService,
38 private userService: UserService,
39 private analyticsService: AnalyticsService,
40 private modalService: NgbModal,
46 this.userService.getUsers()
47 .subscribe((users: any) => this.user = users.anonymous);
50 toggleSidebar(): boolean {
51 this.sidebarService.toggle(true, 'menu-sidebar');
55 toggleSettings(): boolean {
56 this.sidebarService.toggle(false, 'settings-sidebar');
61 this.menuService.navigateHome();
65 this.analyticsService.trackEvent('startSearch');
69 helpClick($event: any) {
70 if ($event.title === 'About') {
71 // FIXME SEB - move code in XDS part
72 const activeModal = this.modalService.open(AboutModalComponent, { size: 'lg', container: 'nb-layout' });