update tslint -> eslint
This commit is contained in:
@@ -1,49 +1,82 @@
|
||||
<div *ngIf="(show$|async) as show">
|
||||
<div *ngIf="show$ | async as show">
|
||||
<app-card
|
||||
closeLink="../"
|
||||
heading="{{show.showType|showType}}, {{show.date.toDate()|date:'dd.MM.yyyy'}} - {{getStatus(show)}}">
|
||||
<i *ngIf="show.public">öffentliche Veranstaltung von
|
||||
heading="{{ show.showType | showType }}, {{
|
||||
show.date.toDate() | date: 'dd.MM.yyyy'
|
||||
}} - {{ getStatus(show) }}"
|
||||
>
|
||||
<i *ngIf="show.public"
|
||||
>öffentliche Veranstaltung von
|
||||
<app-user-name [userId]="show.owner"></app-user-name>
|
||||
</i>
|
||||
<i *ngIf="!show.public">geschlossene Veranstaltung von
|
||||
<i *ngIf="!show.public"
|
||||
>geschlossene Veranstaltung von
|
||||
<app-user-name [userId]="show.owner"></app-user-name>
|
||||
</i>
|
||||
<p *ngIf="!show.published">
|
||||
<mat-checkbox [(ngModel)]="showText">Text anzeigen</mat-checkbox>
|
||||
</p>
|
||||
<div *ngIf="showSongs && songs" class="song-list">
|
||||
<app-song *ngFor="let song of showSongs" [showId]="showId"
|
||||
[showSong]="song"
|
||||
[showSongs]="showSongs"
|
||||
[showText]="showText"
|
||||
[show]="show"
|
||||
[song]="getSong(song.songId)"
|
||||
class="song-row"
|
||||
<app-song
|
||||
*ngFor="let song of showSongs"
|
||||
[Song]="getSong(song.songId)"
|
||||
[showId]="showId"
|
||||
[showSong]="song"
|
||||
[showSongs]="showSongs"
|
||||
[showText]="showText"
|
||||
[show]="show"
|
||||
class="song-row"
|
||||
></app-song>
|
||||
</div>
|
||||
|
||||
<app-add-song *ngIf="songs && !show.published" [showId]="showId" [showSongs]="showSongs"
|
||||
[songs]="songs"></app-add-song>
|
||||
<app-add-song
|
||||
*ngIf="songs && !show.published"
|
||||
[showId]="showId"
|
||||
[showSongs]="showSongs"
|
||||
[songs]="songs"
|
||||
></app-add-song>
|
||||
|
||||
<app-button-row>
|
||||
<ng-container *appOwner="show.owner">
|
||||
<app-button (click)="onArchive(true)" *ngIf="!show.archived" [icon]="faBox">
|
||||
<app-button
|
||||
(click)="onArchive(true)"
|
||||
*ngIf="!show.archived"
|
||||
[icon]="faBox"
|
||||
>
|
||||
Archivieren
|
||||
</app-button>
|
||||
<app-button (click)="onArchive(false)" *ngIf="show.archived" [icon]="faBoxOpen">
|
||||
<app-button
|
||||
(click)="onArchive(false)"
|
||||
*ngIf="show.archived"
|
||||
[icon]="faBoxOpen"
|
||||
>
|
||||
Wiederherstellen
|
||||
</app-button>
|
||||
<app-button (click)="onPublish(true)" *ngIf="!show.published" [icon]="faPublish">
|
||||
<app-button
|
||||
(click)="onPublish(true)"
|
||||
*ngIf="!show.published"
|
||||
[icon]="faPublish"
|
||||
>
|
||||
Veröffentlichen
|
||||
</app-button>
|
||||
<app-button (click)="onPublish(false)" *ngIf="show.published" [icon]="faUnpublish">
|
||||
<app-button
|
||||
(click)="onPublish(false)"
|
||||
*ngIf="show.published"
|
||||
[icon]="faUnpublish"
|
||||
>
|
||||
Veröffentlichung zurückziehen
|
||||
</app-button>
|
||||
</ng-container>
|
||||
<app-button [icon]="faDownload" [matMenuTriggerFor]="menu">Herunterladen</app-button>
|
||||
<app-button [icon]="faDownload" [matMenuTriggerFor]="menu"
|
||||
>Herunterladen
|
||||
</app-button>
|
||||
<mat-menu #menu="matMenu">
|
||||
<app-button (click)="onDownload()" [icon]="faUser">Ablauf für Lobpreisleiter</app-button>
|
||||
<app-button (click)="onDownloadHandout()" [icon]="faUsers">Handout mit Copyright Infos</app-button>
|
||||
<app-button (click)="onDownload()" [icon]="faUser"
|
||||
>Ablauf für Lobpreisleiter
|
||||
</app-button>
|
||||
<app-button (click)="onDownloadHandout()" [icon]="faUsers"
|
||||
>Handout mit Copyright Infos
|
||||
</app-button>
|
||||
</mat-menu>
|
||||
</app-button-row>
|
||||
</app-card>
|
||||
|
||||
@@ -6,12 +6,13 @@ describe('ShowComponent', () => {
|
||||
let component: ShowComponent;
|
||||
let fixture: ComponentFixture<ShowComponent>;
|
||||
|
||||
beforeEach(waitForAsync(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ShowComponent]
|
||||
beforeEach(
|
||||
waitForAsync(() => {
|
||||
void TestBed.configureTestingModule({
|
||||
declarations: [ShowComponent],
|
||||
}).compileComponents();
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
);
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(ShowComponent);
|
||||
@@ -20,6 +21,6 @@ describe('ShowComponent', () => {
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
void expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -20,7 +20,7 @@ import {faUsers} from '@fortawesome/free-solid-svg-icons/faUsers';
|
||||
@Component({
|
||||
selector: 'app-show',
|
||||
templateUrl: './show.component.html',
|
||||
styleUrls: ['./show.component.less']
|
||||
styleUrls: ['./show.component.less'],
|
||||
})
|
||||
export class ShowComponent implements OnInit {
|
||||
public show$: Observable<Show>;
|
||||
@@ -37,29 +37,31 @@ export class ShowComponent implements OnInit {
|
||||
public faUser = faUser;
|
||||
public faUsers = faUsers;
|
||||
|
||||
constructor(
|
||||
public constructor(
|
||||
private activatedRoute: ActivatedRoute,
|
||||
private showService: ShowService,
|
||||
private songService: SongService,
|
||||
private showSongService: ShowSongService,
|
||||
private docxService: DocxService,
|
||||
) {
|
||||
}
|
||||
private docxService: DocxService
|
||||
) {}
|
||||
|
||||
ngOnInit(): void {
|
||||
public ngOnInit(): void {
|
||||
this.show$ = this.activatedRoute.params.pipe(
|
||||
map(param => param.showId),
|
||||
tap(_ => this.showId = _),
|
||||
switchMap(showId => this.showService.read$(showId))
|
||||
map((param: {showId: string}) => param.showId),
|
||||
tap((_: string) => (this.showId = _)),
|
||||
switchMap((showId: string) => this.showService.read$(showId))
|
||||
);
|
||||
this.activatedRoute.params.pipe(
|
||||
map(param => param.showId),
|
||||
switchMap(showId => this.showSongService.list$(showId)),
|
||||
filter(_ => !!_)
|
||||
).subscribe(_ => this.showSongs = _);
|
||||
this.songService.list$().pipe(
|
||||
filter(_ => !!_)
|
||||
).subscribe(_ => this.songs = _);
|
||||
this.activatedRoute.params
|
||||
.pipe(
|
||||
map((param: {showId: string}) => param.showId),
|
||||
switchMap(showId => this.showSongService.list$(showId)),
|
||||
filter(_ => !!_)
|
||||
)
|
||||
.subscribe(_ => (this.showSongs = _));
|
||||
this.songService
|
||||
.list$()
|
||||
.pipe(filter(_ => !!_))
|
||||
.subscribe(_ => (this.songs = _));
|
||||
}
|
||||
|
||||
public getSong(songId: string): Song {
|
||||
@@ -90,6 +92,9 @@ export class ShowComponent implements OnInit {
|
||||
}
|
||||
|
||||
public async onDownloadHandout(): Promise<void> {
|
||||
await this.docxService.create(this.showId, {chordMode: 'hide', copyright: true});
|
||||
await this.docxService.create(this.showId, {
|
||||
chordMode: 'hide',
|
||||
copyright: true,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,21 +1,42 @@
|
||||
<div *ngIf="_song">
|
||||
<div *ngIf="show.published" class="title published">{{_song.title}}</div>
|
||||
<div *ngIf="iSong">
|
||||
<div *ngIf="show.published" class="title published">{{ iSong.title }}</div>
|
||||
|
||||
<div *ngIf="!show.published" class="song">
|
||||
<app-menu-button (click)="reorder(true)" [icon]="faUp" class="btn-up btn-icon"></app-menu-button>
|
||||
<app-menu-button (click)="reorder(false)" [icon]="faDown" class="btn-down btn-icon"></app-menu-button>
|
||||
<span class="title">{{_song.title}}</span>
|
||||
<app-menu-button
|
||||
(click)="reorder(true)"
|
||||
[icon]="faUp"
|
||||
class="btn-up btn-icon"
|
||||
></app-menu-button>
|
||||
<app-menu-button
|
||||
(click)="reorder(false)"
|
||||
[icon]="faDown"
|
||||
class="btn-down btn-icon"
|
||||
></app-menu-button>
|
||||
<span class="title">{{ iSong.title }}</span>
|
||||
<span class="keys">
|
||||
<span *ngIf="showSong.keyOriginal!==showSong.key">{{showSong.keyOriginal}} → </span>
|
||||
<mat-form-field *ngIf="keys" appearance="standard">
|
||||
<span *ngIf="showSong.keyOriginal !== showSong.key"
|
||||
>{{ showSong.keyOriginal }} → </span
|
||||
>
|
||||
<mat-form-field *ngIf="keys" appearance="standard">
|
||||
<mat-select [formControl]="keyFormControl">
|
||||
<mat-option *ngFor="let key of keys" [value]="key">{{key}}</mat-option>
|
||||
<mat-option *ngFor="let key of keys" [value]="key">{{
|
||||
key
|
||||
}}</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
</span>
|
||||
<app-menu-button (click)="onDelete()" [icon]="faDelete" class="btn-delete btn-icon"></app-menu-button>
|
||||
</span>
|
||||
<app-menu-button
|
||||
(click)="onDelete()"
|
||||
[icon]="faDelete"
|
||||
class="btn-delete btn-icon"
|
||||
></app-menu-button>
|
||||
</div>
|
||||
<app-song-text (chordModeChanged)="onChordModeChanged($event)" *ngIf="showText || show.published"
|
||||
[chordMode]="showSong.chordMode" [transpose]="{baseKey: showSong.keyOriginal, targetKey: showSong.key}"
|
||||
[showSwitch]="!show.published" [text]="_song.text"></app-song-text>
|
||||
<app-song-text
|
||||
(chordModeChanged)="onChordModeChanged($event)"
|
||||
*ngIf="showText || show.published"
|
||||
[chordMode]="showSong.chordMode"
|
||||
[showSwitch]="!show.published"
|
||||
[text]="iSong.text"
|
||||
[transpose]="{ baseKey: showSong.keyOriginal, targetKey: showSong.key }"
|
||||
></app-song-text>
|
||||
</div>
|
||||
|
||||
@@ -6,12 +6,13 @@ describe('SongComponent', () => {
|
||||
let component: SongComponent;
|
||||
let fixture: ComponentFixture<SongComponent>;
|
||||
|
||||
beforeEach(waitForAsync(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [SongComponent]
|
||||
beforeEach(
|
||||
waitForAsync(() => {
|
||||
void TestBed.configureTestingModule({
|
||||
declarations: [SongComponent],
|
||||
}).compileComponents();
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
);
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(SongComponent);
|
||||
@@ -20,6 +21,6 @@ describe('SongComponent', () => {
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
void expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -13,7 +13,7 @@ import {Show} from '../../services/show';
|
||||
@Component({
|
||||
selector: 'app-song',
|
||||
templateUrl: './song.component.html',
|
||||
styleUrls: ['./song.component.less']
|
||||
styleUrls: ['./song.component.less'],
|
||||
})
|
||||
export class SongComponent implements OnInit {
|
||||
@Input() public show: Show;
|
||||
@@ -22,30 +22,25 @@ export class SongComponent implements OnInit {
|
||||
@Input() public showId: string;
|
||||
@Input() public showText: boolean;
|
||||
|
||||
|
||||
public keys: string[];
|
||||
public faDelete = faTrash;
|
||||
public faUp = faCaretUp;
|
||||
public faDown = faCaretDown;
|
||||
public keyFormControl: FormControl;
|
||||
public iSong: Song;
|
||||
|
||||
constructor(
|
||||
private showSongService: ShowSongService,
|
||||
) {
|
||||
}
|
||||
|
||||
public _song: Song;
|
||||
public constructor(private showSongService: ShowSongService) {}
|
||||
|
||||
@Input()
|
||||
public set song(song: Song) {
|
||||
this._song = song;
|
||||
this.keys = !!song ? getScale(song.key) : [];
|
||||
public set Song(song: Song) {
|
||||
this.iSong = song;
|
||||
this.keys = song ? getScale(song.key) : [];
|
||||
}
|
||||
|
||||
public ngOnInit(): void {
|
||||
this.keyFormControl = new FormControl(this.showSong.key);
|
||||
this.keyFormControl.valueChanges.subscribe(async value => {
|
||||
await this.showSongService.update$(this.showId, this.showSong.id, {key: value});
|
||||
this.keyFormControl.valueChanges.subscribe((value: string) => {
|
||||
void this.showSongService.update$(this.showId, this.showSong.id, {key: value});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -53,7 +48,6 @@ export class SongComponent implements OnInit {
|
||||
await this.showSongService.delete$(this.showId, this.showSong.id);
|
||||
}
|
||||
|
||||
|
||||
public async reorder(up: boolean): Promise<void> {
|
||||
if (up) {
|
||||
await this.reorderUp();
|
||||
@@ -63,7 +57,7 @@ export class SongComponent implements OnInit {
|
||||
}
|
||||
|
||||
public async reorderUp(): Promise<void> {
|
||||
const index = this.showSongs.findIndex(_ => _.songId === this._song.id);
|
||||
const index = this.showSongs.findIndex(_ => _.songId === this.iSong.id);
|
||||
if (index === 0) {
|
||||
return;
|
||||
}
|
||||
@@ -71,12 +65,16 @@ export class SongComponent implements OnInit {
|
||||
const song = this.showSongs[index];
|
||||
const toggleSong = this.showSongs[index - 1];
|
||||
|
||||
await this.showSongService.update$(this.showId, song.id, {order: toggleSong.order});
|
||||
await this.showSongService.update$(this.showId, toggleSong.id, {order: song.order});
|
||||
await this.showSongService.update$(this.showId, song.id, {
|
||||
order: toggleSong.order,
|
||||
});
|
||||
await this.showSongService.update$(this.showId, toggleSong.id, {
|
||||
order: song.order,
|
||||
});
|
||||
}
|
||||
|
||||
public async reorderDown(): Promise<void> {
|
||||
const index = this.showSongs.findIndex(_ => _.songId === this._song.id);
|
||||
const index = this.showSongs.findIndex(_ => _.songId === this.iSong.id);
|
||||
if (index === this.showSongs.length - 1) {
|
||||
return;
|
||||
}
|
||||
@@ -84,11 +82,17 @@ export class SongComponent implements OnInit {
|
||||
const song = this.showSongs[index];
|
||||
const toggleSong = this.showSongs[index + 1];
|
||||
|
||||
await this.showSongService.update$(this.showId, song.id, {order: toggleSong.order});
|
||||
await this.showSongService.update$(this.showId, toggleSong.id, {order: song.order});
|
||||
await this.showSongService.update$(this.showId, song.id, {
|
||||
order: toggleSong.order,
|
||||
});
|
||||
await this.showSongService.update$(this.showId, toggleSong.id, {
|
||||
order: song.order,
|
||||
});
|
||||
}
|
||||
|
||||
public async onChordModeChanged(value: ChordMode): Promise<void> {
|
||||
await this.showSongService.update$(this.showId, this.showSong.id, {chordMode: value});
|
||||
await this.showSongService.update$(this.showId, this.showSong.id, {
|
||||
chordMode: value,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user