Sengi-Windows-MacOS-Linux/src/app/app.component.ts

50 lines
1.5 KiB
TypeScript
Raw Normal View History

2018-09-10 03:55:16 +02:00
import { Component, OnInit, OnDestroy } from '@angular/core';
2019-02-11 04:23:10 +01:00
import { Subscription, Observable } from 'rxjs';
import { Select } from '@ngxs/store';
// import { ElectronService } from 'ngx-electron';
2018-03-15 01:48:52 +01:00
2019-02-11 04:23:10 +01:00
import { NavigationService, LeftPanelType } from './services/navigation.service';
import { StreamElement } from './states/streams.state';
2018-03-15 01:48:52 +01:00
@Component({
2019-02-11 04:23:10 +01:00
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.scss']
2018-03-15 01:48:52 +01:00
})
2019-02-11 04:23:10 +01:00
export class AppComponent implements OnInit, OnDestroy {
title = 'Sengi';
floatingColumnActive: boolean;
tutorialActive: boolean;
2019-02-25 06:04:09 +01:00
mediaViewerActive: boolean = false;
2019-02-11 04:23:10 +01:00
private columnEditorSub: Subscription;
@Select(state => state.streamsstatemodel.streams) streamElements$: Observable<StreamElement[]>;
constructor(private readonly navigationService: NavigationService) {
}
ngOnInit(): void {
this.streamElements$.subscribe((streams: StreamElement[]) => {
if(streams && streams.length === 0){
this.tutorialActive = true;
} else {
this.tutorialActive = false;
}
});
this.columnEditorSub = this.navigationService.activatedPanelSubject.subscribe((type: LeftPanelType) => {
if (type === LeftPanelType.Closed) {
this.floatingColumnActive = false;
} else {
this.floatingColumnActive = true;
}
});
}
ngOnDestroy(): void {
this.columnEditorSub.unsubscribe();
}
2018-03-15 01:48:52 +01:00
}