persisting songs ins show
This commit is contained in:
@@ -13,9 +13,7 @@ export class SongDataService {
|
||||
|
||||
public list$ = (): Observable<Song[]> => this.dbService.col$(this.collection);
|
||||
public read$ = (songId: string): Observable<Song | null> => this.dbService.doc$(this.collection + '/' + songId);
|
||||
public update$ = async (songId: string, data: Partial<Song>): Promise<void> =>
|
||||
await this.dbService.doc(this.collection + '/' + songId).update(data);
|
||||
public update$ = async (songId: string, data: Partial<Song>): Promise<void> => await this.dbService.doc(this.collection + '/' + songId).update(data);
|
||||
public add = async (data: Partial<Song>): Promise<string> => (await this.dbService.col(this.collection).add(data)).id;
|
||||
public delete = async (songId: string): Promise<void> =>
|
||||
await this.dbService.doc(this.collection + '/' + songId).delete();
|
||||
public delete = async (songId: string): Promise<void> => await this.dbService.doc(this.collection + '/' + songId).delete();
|
||||
}
|
||||
|
||||
@@ -49,9 +49,7 @@ export class TextRenderingService {
|
||||
const type = hasMatches ? LineType.chord : LineType.text;
|
||||
|
||||
const line: Line = {type, text, chords: hasMatches ? cords : null};
|
||||
return transpose !== null && transpose !== undefined
|
||||
? this.transposeService.transpose(line, transpose.baseKey, transpose.targetKey)
|
||||
: this.transposeService.renderChords(line);
|
||||
return transpose !== null && transpose !== undefined ? this.transposeService.transpose(line, transpose.baseKey, transpose.targetKey) : this.transposeService.renderChords(line);
|
||||
}
|
||||
|
||||
private getSectionTypeOfLine(line: string): SectionType | null {
|
||||
|
||||
@@ -33,10 +33,7 @@ export class TransposeService {
|
||||
|
||||
public getDistance(baseKey: string, targetKey: string): number {
|
||||
const scale = getScaleType(baseKey);
|
||||
return scale
|
||||
? (scale[0].indexOf(targetKey) - scale[0].indexOf(baseKey) ??
|
||||
scale[1].indexOf(targetKey) - scale[1].indexOf(baseKey)) % 12
|
||||
: 0;
|
||||
return scale ? (scale[0].indexOf(targetKey) - scale[0].indexOf(baseKey) ?? scale[1].indexOf(targetKey) - scale[1].indexOf(baseKey)) % 12 : 0;
|
||||
}
|
||||
|
||||
public getMap(baseKey: string, difference: number): TransposeMap | null {
|
||||
@@ -74,8 +71,7 @@ export class TransposeService {
|
||||
}
|
||||
|
||||
private renderLine(chords: Chord[]): string {
|
||||
let template =
|
||||
' ';
|
||||
let template = ' ';
|
||||
|
||||
chords.forEach(chord => {
|
||||
const pos = chord.position;
|
||||
@@ -92,10 +88,6 @@ export class TransposeService {
|
||||
}
|
||||
|
||||
private renderChord(chord: Chord) {
|
||||
return (
|
||||
scaleMapping[chord.chord] +
|
||||
(chord.add ? chord.add : '') +
|
||||
(chord.slashChord ? '/' + scaleMapping[chord.slashChord] : '')
|
||||
);
|
||||
return scaleMapping[chord.chord] + (chord.add ? chord.add : '') + (chord.slashChord ? '/' + scaleMapping[chord.slashChord] : '');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user