bugfixing
This commit is contained in:
@@ -18,11 +18,11 @@ export class ListComponent {
|
||||
}
|
||||
|
||||
public getPublicShows(songs: Show[]): Show[] {
|
||||
return songs.filter(_ => _.published)
|
||||
return songs.filter(_ => _.published);
|
||||
}
|
||||
|
||||
public getPrivateSongs(songs: Show[]): Show[] {
|
||||
return songs.filter(_ => !_.published)
|
||||
return songs.filter(_ => !_.published);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -27,12 +27,14 @@ export class NewComponent implements OnInit {
|
||||
this.form = new FormGroup({
|
||||
date: new FormControl(null, Validators.required),
|
||||
showType: new FormControl(null, Validators.required),
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
public async onSave() {
|
||||
this.form.markAllAsTouched();
|
||||
if (!this.form.valid) return;
|
||||
if (!this.form.valid) {
|
||||
return;
|
||||
}
|
||||
|
||||
const id = await this.showService.new$(this.form.value);
|
||||
await this.router.navigateByUrl('/shows/' + id);
|
||||
|
||||
@@ -86,11 +86,11 @@ export class DocxService {
|
||||
},
|
||||
]
|
||||
}
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
private renderSongs(songs: { showSong: ShowSong; song: Song; sections: Section[] }[], options: DownloadOptions, config: Config): Paragraph[] {
|
||||
return songs.reduce((p, song) => [...p, ...this.renderSong(song.showSong, song.song, song.sections, options, config)], [])
|
||||
return songs.reduce((p, song) => [...p, ...this.renderSong(song.showSong, song.song, song.sections, options, config)], []);
|
||||
}
|
||||
|
||||
private renderSong(showSong: ShowSong, song: Song, sections: Section[], options: DownloadOptions, config: Config): Paragraph[] {
|
||||
@@ -121,7 +121,9 @@ export class DocxService {
|
||||
}
|
||||
|
||||
private renderCopyright(song: Song, options: DownloadOptions, config: Config): Paragraph {
|
||||
if (!options?.copyright) return null;
|
||||
if (!options?.copyright) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const label = song.label ? song.label + ', ' : '';
|
||||
const artist = song.artist ? song.artist + ', ' : '';
|
||||
@@ -141,7 +143,9 @@ export class DocxService {
|
||||
private renderSection(section: Section, chordMode: ChordMode): Paragraph[] {
|
||||
return section.lines
|
||||
.filter(line => {
|
||||
if (line.type === LineType.text) return true;
|
||||
if (line.type === LineType.text) {
|
||||
return true;
|
||||
}
|
||||
switch (chordMode) {
|
||||
case 'show':
|
||||
return true;
|
||||
@@ -172,7 +176,7 @@ export class DocxService {
|
||||
thematicBreak: true,
|
||||
});
|
||||
|
||||
return [songTitle]
|
||||
return [songTitle];
|
||||
}
|
||||
|
||||
private async prepareData(showId: string): Promise<{ songs: ({ showSong: ShowSong, song: Song, sections: Section[] })[]; show: Show, user: User, config: Config }> {
|
||||
@@ -191,8 +195,8 @@ export class DocxService {
|
||||
showSong,
|
||||
song,
|
||||
sections
|
||||
}
|
||||
})
|
||||
};
|
||||
});
|
||||
const songs = await Promise.all(songsAsync);
|
||||
return {songs, show, user, config};
|
||||
}
|
||||
@@ -213,5 +217,5 @@ export class DocxService {
|
||||
window.URL.revokeObjectURL(url);
|
||||
document.body.removeChild(a);
|
||||
}, 1000);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,5 +15,5 @@ export class ShowDataService {
|
||||
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 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;
|
||||
}
|
||||
|
||||
@@ -17,5 +17,5 @@ export class ShowSongDataService {
|
||||
public read$ = (showId: string, songId: string): Observable<ShowSong | undefined> => this.dbService.doc$(`${this.collection}/${showId}/${this.subCollection}/${songId}`);
|
||||
public update$ = async (showId: string, songId: string, data: Partial<ShowSong>): Promise<void> => await this.dbService.doc(`${this.collection}/${showId}/${this.subCollection}/${songId}`).update(data);
|
||||
public delete = async (showId: string, songId: string): Promise<void> => await this.dbService.doc(`${this.collection}/${showId}/${this.subCollection}/${songId}`).delete();
|
||||
public add = async (showId: string, data: Partial<ShowSong>): Promise<string> => (await this.dbService.col(`${this.collection}/${showId}/${this.subCollection}`).add(data)).id
|
||||
public add = async (showId: string, data: Partial<ShowSong>): Promise<string> => (await this.dbService.col(`${this.collection}/${showId}/${this.subCollection}`).add(data)).id;
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ export class ShowService {
|
||||
.filter(_ => !_.archived)
|
||||
.filter(show => show.published || (show.owner === _.user.id && !publishedOnly))
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -76,8 +76,12 @@ export class ShowComponent implements OnInit {
|
||||
}
|
||||
|
||||
public getStatus(show: Show): string {
|
||||
if (show.published) return 'veröffentlicht';
|
||||
if (show.reported) return 'gemeldet';
|
||||
if (show.published) {
|
||||
return 'veröffentlicht';
|
||||
}
|
||||
if (show.reported) {
|
||||
return 'gemeldet';
|
||||
}
|
||||
return 'entwurf';
|
||||
}
|
||||
|
||||
|
||||
@@ -40,13 +40,13 @@ export class SongComponent implements OnInit {
|
||||
public set song(song: Song) {
|
||||
this._song = 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});
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
public async onDelete(): Promise<void> {
|
||||
@@ -55,12 +55,18 @@ export class SongComponent implements OnInit {
|
||||
|
||||
|
||||
public async reorder(up: boolean): Promise<void> {
|
||||
if (up) await this.reorderUp(); else await this.reorderDown();
|
||||
if (up) {
|
||||
await this.reorderUp();
|
||||
} else {
|
||||
await this.reorderDown();
|
||||
}
|
||||
}
|
||||
|
||||
public async reorderUp(): Promise<void> {
|
||||
const index = this.showSongs.findIndex(_ => _.songId === this._song.id);
|
||||
if (index === 0) return;
|
||||
if (index === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
const song = this.showSongs[index];
|
||||
const toggleSong = this.showSongs[index - 1];
|
||||
@@ -71,7 +77,9 @@ export class SongComponent implements OnInit {
|
||||
|
||||
public async reorderDown(): Promise<void> {
|
||||
const index = this.showSongs.findIndex(_ => _.songId === this._song.id);
|
||||
if (index === this.showSongs.length - 1) return;
|
||||
if (index === this.showSongs.length - 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
const song = this.showSongs[index];
|
||||
const toggleSong = this.showSongs[index + 1];
|
||||
|
||||
Reference in New Issue
Block a user