mirror of https://gitlab.com/openlp/web-remote.git
Add main view
This commit is contained in:
parent
76c56edfbf
commit
9b37a03c33
|
@ -1,3 +1,3 @@
|
|||
<p>
|
||||
main-view works!
|
||||
</p>
|
||||
<div class="overlay">
|
||||
<img src="{{ img }}">
|
||||
</div>
|
|
@ -0,0 +1,8 @@
|
|||
img {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
vertical-align: middle;
|
||||
height: 100%;
|
||||
background-size: cover;
|
||||
background-repeat: no-repeat;
|
||||
}
|
|
@ -1,4 +1,5 @@
|
|||
import { Component, OnInit } from '@angular/core';
|
||||
import { OpenLPService } from '../../openlp.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-main-view',
|
||||
|
@ -6,10 +7,15 @@ import { Component, OnInit } from '@angular/core';
|
|||
styleUrls: ['./main-view.component.scss', '../overlay.scss']
|
||||
})
|
||||
export class MainViewComponent implements OnInit {
|
||||
|
||||
constructor() { }
|
||||
img: string;
|
||||
constructor(private openlpService: OpenLPService) { }
|
||||
|
||||
ngOnInit() {
|
||||
this.openlpService.stateChanged$.subscribe(item => this.updateImage());
|
||||
}
|
||||
|
||||
updateImage(): void {
|
||||
this.openlpService.getMainImage().subscribe(view => this.img = view.slide_image);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -4,7 +4,8 @@ import { URLSearchParams, Http } from '@angular/http';
|
|||
|
||||
import { Observable } from 'rxjs';
|
||||
import { map, take } from 'rxjs/operators';
|
||||
import { PluginDescription, State, Slide, ServiceItem } from './responses';
|
||||
|
||||
import { PluginDescription, State, Slide, ServiceItem, MainView } from './responses';
|
||||
import { environment } from '../environments/environment';
|
||||
|
||||
let deserialize = (json, cls) => {
|
||||
|
@ -46,6 +47,10 @@ export class OpenLPService {
|
|||
}
|
||||
}
|
||||
|
||||
getMainImage(): Observable<MainView> {
|
||||
return this.http.get<MainView>(`${this.apiURL}/main/image`);
|
||||
}
|
||||
|
||||
getItemSlides(): Observable<Slide[]> {
|
||||
return this.http.get<Slide[]>(`${this.apiURL}/controller/live/text`);
|
||||
}
|
||||
|
|
|
@ -33,4 +33,8 @@ export interface ServiceItem {
|
|||
plugin: string;
|
||||
selected: boolean;
|
||||
title: string;
|
||||
}
|
||||
|
||||
export interface MainView {
|
||||
slide_image: string;
|
||||
}
|
Loading…
Reference in New Issue