2017-03-01 14:30:25 +00:00
|
|
|
import { Component, ViewChild, OnInit } from '@angular/core';
|
|
|
|
import { Observable } from 'rxjs/Observable';
|
|
|
|
import { DocumentService, DocumentContents } from 'app/documents/document.service';
|
2017-03-05 21:25:41 +00:00
|
|
|
import { NavigationService, NavigationViews, NavigationNode } from 'app/navigation/navigation.service';
|
2017-03-13 19:58:31 +00:00
|
|
|
import { SearchService } from 'app/search/search.service';
|
2017-02-02 23:02:23 -08:00
|
|
|
|
2017-01-27 00:20:51 -08:00
|
|
|
@Component({
|
2017-02-02 12:10:47 -08:00
|
|
|
selector: 'aio-shell',
|
2017-03-06 15:08:34 +00:00
|
|
|
templateUrl: './app.component.html',
|
|
|
|
styleUrls: ['./app.component.scss'],
|
2017-01-27 00:20:51 -08:00
|
|
|
})
|
2017-03-01 14:30:25 +00:00
|
|
|
export class AppComponent implements OnInit {
|
2017-03-02 13:28:28 +00:00
|
|
|
readonly sideBySideWidth = 600;
|
2017-03-09 16:31:20 +00:00
|
|
|
readonly homeImageUrl = 'assets/images/logos/angular2/angular_solidBlack.svg';
|
2017-03-02 13:28:28 +00:00
|
|
|
|
2017-02-15 11:22:37 -08:00
|
|
|
isHamburgerVisible = true; // always ... for now
|
2017-03-01 14:30:25 +00:00
|
|
|
isSideBySide = false;
|
|
|
|
|
|
|
|
currentDocument: Observable<DocumentContents>;
|
|
|
|
navigationViews: Observable<NavigationViews>;
|
2017-03-05 21:25:41 +00:00
|
|
|
selectedNodes: Observable<NavigationNode[]>;
|
2017-03-01 14:30:25 +00:00
|
|
|
|
2017-03-01 23:05:16 +00:00
|
|
|
constructor(documentService: DocumentService, navigationService: NavigationService, private searchService: SearchService) {
|
2017-03-01 14:30:25 +00:00
|
|
|
this.currentDocument = documentService.currentDocument;
|
|
|
|
this.navigationViews = navigationService.navigationViews;
|
2017-03-06 10:13:49 +00:00
|
|
|
this.selectedNodes = navigationService.selectedNodes;
|
2017-03-01 14:30:25 +00:00
|
|
|
}
|
2017-02-15 11:22:37 -08:00
|
|
|
|
2017-03-01 14:30:25 +00:00
|
|
|
ngOnInit() {
|
2017-03-02 12:20:26 +00:00
|
|
|
this.searchService.initWorker('app/search/search-worker.js');
|
|
|
|
this.searchService.loadIndex();
|
|
|
|
|
2017-03-01 14:30:25 +00:00
|
|
|
this.onResize(window.innerWidth);
|
|
|
|
}
|
2017-02-15 11:22:37 -08:00
|
|
|
|
2017-03-01 14:30:25 +00:00
|
|
|
onResize(width) {
|
|
|
|
this.isSideBySide = width > this.sideBySideWidth;
|
|
|
|
}
|
2017-01-27 00:20:51 -08:00
|
|
|
}
|