presenter function base
This commit is contained in:
39
src/app/modules/presentation/monitor/monitor.component.ts
Normal file
39
src/app/modules/presentation/monitor/monitor.component.ts
Normal file
@@ -0,0 +1,39 @@
|
||||
import {Component, OnInit} from '@angular/core';
|
||||
import {ActivatedRoute} from '@angular/router';
|
||||
import {map, switchMap, tap} from 'rxjs/operators';
|
||||
import {ShowService} from '../../shows/services/show.service';
|
||||
import {SongService} from '../../songs/services/song.service';
|
||||
import {Section, TextRenderingService} from '../../songs/services/text-rendering.service';
|
||||
import {Song} from '../../songs/services/song';
|
||||
|
||||
@Component({
|
||||
selector: 'app-monitor',
|
||||
templateUrl: './monitor.component.html',
|
||||
styleUrls: ['./monitor.component.less']
|
||||
})
|
||||
export class MonitorComponent implements OnInit {
|
||||
public song: Song;
|
||||
private index: number;
|
||||
private sections: Section[];
|
||||
|
||||
constructor(
|
||||
private activatedRoute: ActivatedRoute,
|
||||
private showService: ShowService,
|
||||
private songService: SongService,
|
||||
private textRenderingService: TextRenderingService,
|
||||
) {
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.activatedRoute.params.pipe(
|
||||
map(_ => _.showId),
|
||||
switchMap(_ => this.showService.read$(_)),
|
||||
tap(_ => this.index = _.presentationSection),
|
||||
switchMap(_ => this.songService.read(_.presentationSongId))
|
||||
).subscribe(_ => {
|
||||
this.song = _;
|
||||
this.sections = this.textRenderingService.parse(_.text);
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user