presenter function base

This commit is contained in:
2020-04-01 14:19:56 +02:00
committed by smuddy
parent 49e51f015e
commit 643f3aff43
20 changed files with 382 additions and 3 deletions

View File

@@ -0,0 +1,5 @@
<div class="fullscreen">
<app-song-text [showSwitch]="false" [text]="song.text" chordMode="hide"></app-song-text>
</div>

View File

@@ -0,0 +1,14 @@
.fullscreen {
position: fixed;
top: 0;
left: 0;
bottom: 0;
right: 0;
background: black;
z-index: 1;
padding: 50px;
color: white;
font-size: 30px;
}

View File

@@ -0,0 +1,25 @@
import {async, ComponentFixture, TestBed} from '@angular/core/testing';
import {MonitorComponent} from './monitor.component';
describe('MonitorComponent', () => {
let component: MonitorComponent;
let fixture: ComponentFixture<MonitorComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [MonitorComponent]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(MonitorComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View 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);
});
}
}