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] : '');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,11 +20,7 @@ export class SongListComponent implements OnInit, OnDestroy {
|
||||
public songs$: Observable<Song[]> | null = null;
|
||||
public anyFilterActive = false;
|
||||
|
||||
public constructor(
|
||||
private songService: SongService,
|
||||
private activatedRoute: ActivatedRoute,
|
||||
private scrollService: ScrollService
|
||||
) {}
|
||||
public constructor(private songService: SongService, private activatedRoute: ActivatedRoute, private scrollService: ScrollService) {}
|
||||
|
||||
public ngOnInit(): void {
|
||||
const filter$ = this.activatedRoute.queryParams.pipe(
|
||||
|
||||
@@ -18,11 +18,7 @@ export class EditFileComponent {
|
||||
public songId: string | null = null;
|
||||
public files$: Observable<File[]>;
|
||||
|
||||
public constructor(
|
||||
private activatedRoute: ActivatedRoute,
|
||||
private uploadService: UploadService,
|
||||
private fileService: FileDataService
|
||||
) {
|
||||
public constructor(private activatedRoute: ActivatedRoute, private uploadService: UploadService, private fileService: FileDataService) {
|
||||
this.activatedRoute.params
|
||||
.pipe(
|
||||
map(param => param as {songId: string}),
|
||||
|
||||
@@ -28,14 +28,7 @@ import {HistoryComponent} from './history/history.component';
|
||||
import {SongTextModule} from '../../../../widget-modules/components/song-text/song-text.module';
|
||||
|
||||
@NgModule({
|
||||
declarations: [
|
||||
EditComponent,
|
||||
EditSongComponent,
|
||||
EditFileComponent,
|
||||
FileComponent,
|
||||
SaveDialogComponent,
|
||||
HistoryComponent,
|
||||
],
|
||||
declarations: [EditComponent, EditSongComponent, EditFileComponent, FileComponent, SaveDialogComponent, HistoryComponent],
|
||||
exports: [EditComponent],
|
||||
bootstrap: [SaveDialogComponent],
|
||||
imports: [
|
||||
|
||||
@@ -11,15 +11,6 @@ import {AutofocusModule} from '../../../../widget-modules/directives/autofocus/a
|
||||
|
||||
@NgModule({
|
||||
declarations: [NewComponent],
|
||||
imports: [
|
||||
CommonModule,
|
||||
CardModule,
|
||||
ReactiveFormsModule,
|
||||
MatFormFieldModule,
|
||||
MatInputModule,
|
||||
ButtonRowModule,
|
||||
ButtonModule,
|
||||
AutofocusModule,
|
||||
],
|
||||
imports: [CommonModule, CardModule, ReactiveFormsModule, MatFormFieldModule, MatInputModule, ButtonRowModule, ButtonModule, AutofocusModule],
|
||||
})
|
||||
export class NewModule {}
|
||||
|
||||
Reference in New Issue
Block a user