user preferences - chord type

This commit is contained in:
2020-03-22 14:06:50 +01:00
committed by smuddy
parent 7d8f6dd80b
commit aa57dc2ce3
19 changed files with 93 additions and 21 deletions

View File

@@ -12,6 +12,6 @@ export class SongDataService {
public list$ = (): Observable<Song[]> => this.dbService.col$('songs');
public read$ = (songId: string): Observable<Song | undefined> => this.dbService.doc$('songs/' + songId);
public update = async (songId: string, data: any): Promise<void> => await this.dbService.doc('songs/' + songId).update(data);
public update$ = async (songId: string, data: any): Promise<void> => await this.dbService.doc('songs/' + songId).update(data);
}

View File

@@ -26,8 +26,8 @@ export class SongService {
public list$ = (): Observable<Song[]> => this.songDataService.list$().pipe(tap(_ => this.list = _));
public read = (songId: string): Observable<Song | undefined> => this.songDataService.read$(songId);
public async update(songId: string, data: any): Promise<void> {
await this.songDataService.update(songId, data);
public async update$(songId: string, data: Partial<Song>): Promise<void> {
await this.songDataService.update$(songId, data);
}
// https://www.csvjson.com/csv2json
@@ -48,11 +48,12 @@ export class SongService {
if (mappedSongs.length === 1) {
const mappedSong = mappedSongs[0];
const id = _.id;
return await this.update(id, mappedSong);
return await this.update$(id, mappedSong);
}
});
await Promise.all(promises);
}
}

View File

@@ -57,7 +57,6 @@ export class TextRenderingService {
array[array.length - 1].lines.push(this.getLineOfLineText(line));
return array;
}, [] as Section[]);
console.log(indices);
return sections;
}
@@ -90,8 +89,8 @@ export class TextRenderingService {
let match;
const chords: Chord[] = [];
// https://regex101.com/r/68jMB8/3
const regex = /\b(C#|C|Db|D#|D|Eb|E|F#|F|Gb|G#|G|Ab|A#|A|B|H|c#|c|db|d#|d|eb|e|f#|f|gb|g#|g|ab|a#|a|b|h)(\/(C#|C|Db|D#|D|Eb|E|F#|F|Gb|G#|G|Ab|A#|A|B|H|c#|c|db|d#|d|eb|e|f#|f|gb|g#|g|ab|a#|a|b|h))?(\d+|maj7)?\s?\b/mg;
// https://regex101.com/r/68jMB8/5
const regex = /\b(C#|C|Db|D#|D|Eb|E|F#|F|Gb|G#|G|Ab|A#|A|B|H|c#|c|db|d#|d|eb|e|f#|f|gb|g#|g|ab|a#|a|b|h)(\/(C#|C|Db|D#|D|Eb|E|F#|F|Gb|G#|G|Ab|A#|A|B|H|c#|c|db|d#|d|eb|e|f#|f|gb|g#|g|ab|a#|a|b|h))?(\d+|maj7)?\b\s/mg;
while ((match = regex.exec(chordLine)) !== null) {
const chord: Chord = {

View File

@@ -41,7 +41,7 @@ export class EditSongComponent implements OnInit {
public async onSave(): Promise<void> {
const data = this.form.value;
await this.songService.update(this.song.id, data);
await this.songService.update$(this.song.id, data);
await this.router.navigateByUrl('songs/' + this.song.id);
}