publish show

This commit is contained in:
2020-04-17 15:13:39 +02:00
committed by smuddy
parent b8fbcb4b9a
commit c5748d5e34
19 changed files with 126 additions and 63 deletions

View File

@@ -1,3 +1,16 @@
:host {
position: fixed;
display: block;
z-index: 1;
bottom: 0;
left: 0;
right: 0;
background: #000c;
padding: 50px;
box-sizing: border-box;
box-shadow: 0px 0px 26px 10px #000;
}
p { p {
font-size: 15px; font-size: 15px;
margin: 10px 0 0 0; margin: 10px 0 0 0;

View File

@@ -1,6 +1,4 @@
<div [style.font-size.px]="zoom" class="fullscreen"> <div [style.font-size.px]="zoom" class="fullscreen">
<app-song-text [showSwitch]="false" [text]="song.text" chordMode="hide"></app-song-text> <app-song-text [showSwitch]="false" [text]="song.text" chordMode="hide"></app-song-text>
<app-legal [song]="song"></app-legal> <app-legal [song]="song"></app-legal>
</div> </div>

View File

@@ -14,4 +14,5 @@
display: flex; display: flex;
flex-direction: column; flex-direction: column;
justify-content: space-between; justify-content: space-between;
transition: 300ms all ease-in-out;
} }

View File

@@ -13,8 +13,8 @@ import {Song} from '../../songs/services/song';
}) })
export class MonitorComponent implements OnInit { export class MonitorComponent implements OnInit {
public song: Song; public song: Song;
public zoom: number;
private index: number; private index: number;
private zoom: number;
private sections: Section[]; private sections: Section[];
constructor( constructor(

View File

@@ -13,6 +13,8 @@ import {SongTextModule} from '../../widget-modules/components/song-text/song-tex
import {LegalComponent} from './monitor/legal/legal.component'; import {LegalComponent} from './monitor/legal/legal.component';
import {MatButtonModule} from '@angular/material/button'; import {MatButtonModule} from '@angular/material/button';
import {FontAwesomeModule} from '@fortawesome/angular-fontawesome'; import {FontAwesomeModule} from '@fortawesome/angular-fontawesome';
import {MatSliderModule} from '@angular/material/slider';
import {FormsModule} from '@angular/forms';
@NgModule({ @NgModule({
@@ -27,7 +29,9 @@ import {FontAwesomeModule} from '@fortawesome/angular-fontawesome';
SectionTypeTranslatorModule, SectionTypeTranslatorModule,
SongTextModule, SongTextModule,
MatButtonModule, MatButtonModule,
FontAwesomeModule FontAwesomeModule,
MatSliderModule,
FormsModule
] ]
}) })
export class PresentationModule { export class PresentationModule {

View File

@@ -1,6 +1,9 @@
<div *ngIf="shows$|async as shows"> <div *ngIf="shows$|async as shows">
<app-card> <app-card>
<mat-form-field appearance="outline">
<p *ngIf="!shows.length">Es ist derzeit keine Veranstaltung vorhanden</p>
<mat-form-field *ngIf="shows.length>0" appearance="outline">
<mat-label>Veranstaltung</mat-label> <mat-label>Veranstaltung</mat-label>
<mat-select (selectionChange)="onShowChanged($event)"> <mat-select (selectionChange)="onShowChanged($event)">
<mat-option *ngFor="let show of shows" [value]="show.id"> <mat-option *ngFor="let show of shows" [value]="show.id">
@@ -21,18 +24,20 @@
</div> </div>
</div> </div>
<div *ngIf="show"> <div *ngIf="show" class="div-bottom">
<button [routerLink]="'/presentation/monitor/' + currentShowId" mat-icon-button> <button [routerLink]="'/presentation/monitor/' + currentShowId" mat-icon-button>
<fa-icon [icon]="faDesktop"></fa-icon> <fa-icon [icon]="faDesktop"></fa-icon>
</button> </button>
<button (click)="onZoomIn()" mat-icon-button> <mat-slider
<fa-icon [icon]="faZoomIn"></fa-icon> (ngModelChange)="onZoom($event)"
</button> [max]="100"
{{show.presentationZoom}}px [min]="10"
<button (click)="onZoomOut()" mat-icon-button> [ngModel]="show.presentationZoom"
<fa-icon [icon]="faZoomOut"></fa-icon> [step]="2"
</button> [thumbLabel]="true"
>
</mat-slider>
</div> </div>
</app-card> </app-card>

View File

@@ -65,3 +65,8 @@
.fragment { .fragment {
padding: 10px; padding: 10px;
} }
.div-bottom {
display: grid;
grid-template-columns: 40px auto;
}

View File

@@ -1,5 +1,4 @@
import {Component} from '@angular/core'; import {Component} from '@angular/core';
import {ShowDataService} from '../../shows/services/show-data.service';
import {Observable} from 'rxjs'; import {Observable} from 'rxjs';
import {Show} from '../../shows/services/show'; import {Show} from '../../shows/services/show';
import {MatSelectChange} from '@angular/material/select'; import {MatSelectChange} from '@angular/material/select';
@@ -7,9 +6,8 @@ import {ShowSongService} from '../../shows/services/show-song.service';
import {SongService} from '../../songs/services/song.service'; import {SongService} from '../../songs/services/song.service';
import {Song} from '../../songs/services/song'; import {Song} from '../../songs/services/song';
import {Section, TextRenderingService} from '../../songs/services/text-rendering.service'; import {Section, TextRenderingService} from '../../songs/services/text-rendering.service';
import {faSearchPlus} from '@fortawesome/free-solid-svg-icons/faSearchPlus';
import {faSearchMinus} from '@fortawesome/free-solid-svg-icons/faSearchMinus';
import {faDesktop} from '@fortawesome/free-solid-svg-icons/faDesktop'; import {faDesktop} from '@fortawesome/free-solid-svg-icons/faDesktop';
import {ShowService} from '../../shows/services/show.service';
export interface PresentationSong { export interface PresentationSong {
id: string; id: string;
@@ -29,23 +27,21 @@ export class RemoteComponent {
public presentationSongs: PresentationSong[]; public presentationSongs: PresentationSong[];
public currentShowId: string; public currentShowId: string;
public faZoomIn = faSearchPlus;
public faZoomOut = faSearchMinus;
public faDesktop = faDesktop; public faDesktop = faDesktop;
constructor( constructor(
private showDataService: ShowDataService, private showService: ShowService,
private showSongService: ShowSongService, private showSongService: ShowSongService,
private songService: SongService, private songService: SongService,
private textRenderingService: TextRenderingService private textRenderingService: TextRenderingService
) { ) {
this.shows$ = showDataService.list$(); this.shows$ = showService.list$(true);
songService.list$().subscribe(_ => this.songs = _); songService.list$().subscribe(_ => this.songs = _);
} }
public onShowChanged(change: MatSelectChange): void { public onShowChanged(change: MatSelectChange): void {
this.currentShowId = change.value; this.currentShowId = change.value;
this.showDataService.read$(change.value).subscribe(_ => this.show = _); this.showService.read$(change.value).subscribe(_ => this.show = _);
this.showSongService.list$(change.value).subscribe(_ => { this.showSongService.list$(change.value).subscribe(_ => {
this.presentationSongs = _ this.presentationSongs = _
.map(song => this.songs.filter(f => f.id == song.songId)[0]) .map(song => this.songs.filter(f => f.id == song.songId)[0])
@@ -62,22 +58,15 @@ export class RemoteComponent {
} }
public async onSectionClick(id: string, index: number): Promise<void> { public async onSectionClick(id: string, index: number): Promise<void> {
await this.showDataService.update(this.currentShowId, { await this.showService.update$(this.currentShowId, {
presentationSongId: id, presentationSongId: id,
presentationSection: index presentationSection: index
}) })
} }
public async onZoomIn() { public async onZoom(zoom: number) {
debugger await this.showService.update$(this.currentShowId, {
await this.showDataService.update(this.currentShowId, { presentationZoom: zoom,
presentationZoom: (this.show.presentationZoom ?? 30) + 2,
});
}
public async onZoomOut() {
await this.showDataService.update(this.currentShowId, {
presentationZoom: (this.show.presentationZoom ?? 30) - 2,
}); });
} }
} }

View File

@@ -1,8 +1,8 @@
import {Component} from '@angular/core'; import {Component} from '@angular/core';
import {Observable} from 'rxjs'; import {Observable} from 'rxjs';
import {Show} from '../services/show'; import {Show} from '../services/show';
import {ShowDataService} from '../services/show-data.service';
import {fade} from '../../../animations'; import {fade} from '../../../animations';
import {ShowService} from '../services/show.service';
@Component({ @Component({
selector: 'app-list', selector: 'app-list',
@@ -13,8 +13,8 @@ import {fade} from '../../../animations';
export class ListComponent { export class ListComponent {
public shows$: Observable<Show[]>; public shows$: Observable<Show[]>;
constructor(showDataService: ShowDataService) { constructor(showService: ShowService) {
this.shows$ = showDataService.list$(); this.shows$ = showService.list$();
} }
} }

View File

@@ -12,7 +12,7 @@ export class ShowDataService {
constructor(private dbService: DbService) { constructor(private dbService: DbService) {
} }
public list$ = (): Observable<Show[]> => this.dbService.col$(this.collection); public list$ = (queryFn?): Observable<Show[]> => this.dbService.col$(this.collection, queryFn);
public read$ = (showId: string): Observable<Show | undefined> => this.dbService.doc$(`${this.collection}/${showId}`); public read$ = (showId: string): Observable<Show | undefined> => this.dbService.doc$(`${this.collection}/${showId}`);
public update = async (showId: string, data: Partial<Show>): Promise<void> => await this.dbService.doc(`${this.collection}/${showId}`).update(data); public update = async (showId: string, data: Partial<Show>): Promise<void> => await this.dbService.doc(`${this.collection}/${showId}`).update(data);
public add = async (data: Partial<Show>): Promise<string> => (await this.dbService.col(this.collection).add(data)).id public add = async (data: Partial<Show>): Promise<string> => (await this.dbService.col(this.collection).add(data)).id

View File

@@ -2,6 +2,9 @@ import {Injectable} from '@angular/core';
import {ShowDataService} from './show-data.service'; import {ShowDataService} from './show-data.service';
import {Show} from './show'; import {Show} from './show';
import {Observable} from 'rxjs'; import {Observable} from 'rxjs';
import {UserService} from '../../../services/user.service';
import {map, switchMap} from 'rxjs/operators';
import {User} from '../../../services/user';
@Injectable({ @Injectable({
providedIn: 'root' providedIn: 'root'
@@ -11,15 +14,32 @@ export class ShowService {
public static SHOW_TYPE = ['service-worship', 'service-praise', 'home-group-big', 'home-group', 'prayer-group', 'teens-group', 'kids-group', 'misc-public', 'misc-private']; public static SHOW_TYPE = ['service-worship', 'service-praise', 'home-group-big', 'home-group', 'prayer-group', 'teens-group', 'kids-group', 'misc-public', 'misc-private'];
public static SHOW_TYPE_PUBLIC = ['service-worship', 'service-praise', 'home-group-big', 'teens-group', 'kids-group', 'misc-public']; public static SHOW_TYPE_PUBLIC = ['service-worship', 'service-praise', 'home-group-big', 'teens-group', 'kids-group', 'misc-public'];
public static SHOW_TYPE_PRIVATE = ['home-group', 'prayer-group', 'misc-private',]; public static SHOW_TYPE_PRIVATE = ['home-group', 'prayer-group', 'misc-private',];
private user: User;
constructor(private showDataService: ShowDataService) { constructor(private showDataService: ShowDataService, private userService: UserService) {
userService.user$.subscribe(_ => this.user = _);
} }
public read$ = (showId: string): Observable<Show> => this.showDataService.read$(showId); public read$ = (showId: string): Observable<Show> => this.showDataService.read$(showId);
public list$(publishedOnly: boolean = false): Observable<Show[]> {
return this.userService.user$.pipe(
switchMap(_ => this.showDataService.list$(), (user: User, shows: Show[]) => ({user, shows})),
map(_ => _.shows
.filter(_ => !_.archived)
.filter(show => show.published || (show.owner === _.user.id && !publishedOnly))
)
)
}
public update$ = async (showId: string, data: Partial<Show>): Promise<void> => this.showDataService.update(showId, data);
public async new$(data: Partial<Show>): Promise<string> { public async new$(data: Partial<Show>): Promise<string> {
const calculatedData: Partial<Show> = { const calculatedData: Partial<Show> = {
...data, ...data,
owner: this.user.id,
public: ShowService.SHOW_TYPE_PUBLIC.indexOf(data.showType) !== -1, public: ShowService.SHOW_TYPE_PUBLIC.indexOf(data.showType) !== -1,
}; };
return await this.showDataService.add(calculatedData); return await this.showDataService.add(calculatedData);

View File

@@ -8,6 +8,8 @@ export interface Show {
owner: string; owner: string;
public: boolean; public: boolean;
reported: boolean; reported: boolean;
published: boolean;
archived: boolean;
presentationSongId: string; presentationSongId: string;
presentationSection: number; presentationSection: number;

View File

@@ -1,16 +1,18 @@
<div *ngIf="(show$|async) as show"> <div *ngIf="(show$|async) as show">
<app-card <app-card
heading="{{show.showType|showType}}, {{show.date.toDate()|date:'dd.MM.yyyy'}}"> heading="{{show.showType|showType}}, {{show.date.toDate()|date:'dd.MM.yyyy'}} - {{getStatus(show)}}">
<i *ngIf="show.public">öffentliche Veranstaltung</i>
<i *ngIf="!show.public">geschlossene Veranstaltung</i>
<p>
<mat-checkbox [(ngModel)]="showText">Text anzeigen</mat-checkbox> <mat-checkbox [(ngModel)]="showText">Text anzeigen</mat-checkbox>
</p>
<div *ngIf="showSongs && songs" class="song-list"> <div *ngIf="showSongs && songs" class="song-list">
<app-song *ngFor="let song of showSongs" class="song-row" <app-song *ngFor="let song of showSongs" [showId]="showId"
[showId]="showId"
[showSong]="song" [showSong]="song"
[showSongs]="showSongs" [showSongs]="showSongs"
[song]="getSong(song.songId)"
[showText]="showText" [showText]="showText"
[song]="getSong(song.songId)"
class="song-row"
></app-song> ></app-song>
</div> </div>
@@ -23,5 +25,11 @@
</mat-form-field> </mat-form-field>
<button mat-button>aus Übersicht</button> <button mat-button>aus Übersicht</button>
</div> </div>
<app-button-row>
<button (click)="onArchive(true)" *ngIf="!show.archived" mat-button>Archivieren</button>
<button (click)="onArchive(false)" *ngIf="show.archived" mat-button>Wiederherstellen</button>
<button (click)="onPublish(true)" *ngIf="!show.published" mat-button>Veröffentlichen</button>
<button (click)="onPublish(false)" *ngIf="show.published" mat-button>Veröffentlichung zurückziehen</button>
</app-button-row>
</app-card> </app-card>
</div> </div>

View File

@@ -69,4 +69,18 @@ export class ShowComponent implements OnInit {
const filtered = this.songs.filter(_ => _.id === songId); const filtered = this.songs.filter(_ => _.id === songId);
return filtered.length > 0 ? filtered[0] : null; return filtered.length > 0 ? filtered[0] : null;
} }
public async onArchive(archived: boolean): Promise<void> {
await this.showService.update$(this.showId, {archived});
}
public async onPublish(published: boolean): Promise<void> {
await this.showService.update$(this.showId, {published});
}
public getStatus(show: Show): string {
if (show.published) return 'veröffentlicht';
if (show.reported) return 'gemeldet';
return 'entwurf';
}
} }

View File

@@ -14,5 +14,5 @@
<app-menu-button (click)="onDelete()" [icon]="faDelete" class="btnDelete"></app-menu-button> <app-menu-button (click)="onDelete()" [icon]="faDelete" class="btnDelete"></app-menu-button>
</div> </div>
<app-song-text (chordModeChanged)="onChordModeChanged($event)" *ngIf="showText" [chordMode]="showSong.chordMode" <app-song-text (chordModeChanged)="onChordModeChanged($event)" *ngIf="showText" [chordMode]="showSong.chordMode"
[text]="_song.text"></app-song-text> [showSwitch]="true" [text]="_song.text"></app-song-text>
</div> </div>

View File

@@ -1,6 +1,4 @@
.song { .song {
display: grid; display: grid;
grid-template-columns: 20px 20px auto 70px 25px; grid-template-columns: 20px 20px auto 70px 25px;

View File

@@ -16,7 +16,8 @@
</div> </div>
<!-- <div class="text">{{song.text}}</div>--> <!-- <div class="text">{{song.text}}</div>-->
<app-song-text *ngIf="user$|async as user" [chordMode]="user.chordMode" [text]="song.text"></app-song-text> <app-song-text *ngIf="user$|async as user" [chordMode]="user.chordMode" [showSwitch]="true"
[text]="song.text"></app-song-text>
<div class="text">{{song.comment}}</div> <div class="text">{{song.comment}}</div>
<div> <div>

View File

@@ -1,6 +1,6 @@
import {Injectable} from '@angular/core'; import {Injectable} from '@angular/core';
import {AngularFireAuth} from '@angular/fire/auth'; import {AngularFireAuth} from '@angular/fire/auth';
import {Observable} from 'rxjs'; import {BehaviorSubject, Observable} from 'rxjs';
import {filter, switchMap} from 'rxjs/operators'; import {filter, switchMap} from 'rxjs/operators';
import {User} from './user'; import {User} from './user';
import {DbService} from './db.service'; import {DbService} from './db.service';
@@ -10,13 +10,16 @@ import {DbService} from './db.service';
}) })
export class UserService { export class UserService {
constructor(private afAuth: AngularFireAuth, private db: DbService) { constructor(private afAuth: AngularFireAuth, private db: DbService) {
this.afAuth.authState.pipe(
filter(_ => !!_),
switchMap(auth => this.db.doc$<User>('user/' + auth.uid)),
).subscribe(_ => this._user$.next(_));
} }
private _user$ = new BehaviorSubject<User>(null);
public get user$(): Observable<User> { public get user$(): Observable<User> {
return this.afAuth.authState.pipe( return this._user$.pipe(filter(_ => !!_));
filter(_ => !!_),
switchMap(auth => this.db.doc$<User>('user/' + auth.uid))
);
} }
public async update$(uid: string, data: Partial<User>): Promise<void> { public async update$(uid: string, data: Partial<User>): Promise<void> {

View File

@@ -17,19 +17,21 @@ export type ChordMode = 'show' | 'hide' | 'onlyFirst'
}) })
export class SongTextComponent implements OnInit { export class SongTextComponent implements OnInit {
public sections: Section[]; public sections: Section[];
public _chordMode: ChordMode = 'hide'; @Input() public scrollIndex = 0;
@Input() showSwitch = false; @Input() showSwitch = false;
@Input()
public set chordMode(value: ChordMode) {
this._chordMode = value ?? 'hide';
}
@Output() public chordModeChanged = new EventEmitter<ChordMode>(); @Output() public chordModeChanged = new EventEmitter<ChordMode>();
public faLines = faGripLines; public faLines = faGripLines;
constructor(private textRenderingService: TextRenderingService, private elRef: ElementRef) { constructor(private textRenderingService: TextRenderingService, private elRef: ElementRef) {
} }
public _chordMode: ChordMode = 'hide';
@Input()
public set chordMode(value: ChordMode) {
this._chordMode = value ?? 'hide';
}
@Input() @Input()
public set text(value: string) { public set text(value: string) {
this.sections = this.textRenderingService.parse(value).sort((a, b) => a.type - b.type); this.sections = this.textRenderingService.parse(value).sort((a, b) => a.type - b.type);
@@ -61,6 +63,10 @@ export class SongTextComponent implements OnInit {
this.chordModeChanged.emit(next); this.chordModeChanged.emit(next);
} }
public onClick() {
scrollTo(0, this.elRef.nativeElement.offsetTop - 20);
}
private getNextChordMode(): ChordMode { private getNextChordMode(): ChordMode {
switch (this._chordMode) { switch (this._chordMode) {
case 'show': case 'show':
@@ -71,8 +77,4 @@ export class SongTextComponent implements OnInit {
return 'show'; return 'show';
} }
} }
public onClick() {
scrollTo(0, this.elRef.nativeElement.offsetTop - 20);
}
} }