fix: ordering songs in show
This commit is contained in:
@@ -2,12 +2,12 @@
|
|||||||
<app-card
|
<app-card
|
||||||
heading="{{show.showType|showType}}, {{show.date.toDate()|date:'dd.MM.yyyy'}}">
|
heading="{{show.showType|showType}}, {{show.date.toDate()|date:'dd.MM.yyyy'}}">
|
||||||
|
|
||||||
<div *ngIf="showSongs" class="song-list">
|
<div *ngIf="showSongs && songs" class="song-list">
|
||||||
<app-song *ngFor="let song of showSongs"
|
<app-song *ngFor="let song of showSongs"
|
||||||
[showId]="showId"
|
[showId]="showId"
|
||||||
[showSong]="song"
|
[showSong]="song"
|
||||||
[showSongs]="showSongs"
|
[showSongs]="showSongs"
|
||||||
[song]="getSong(songs, song.songId)"
|
[song]="getSong(song.songId)"
|
||||||
></app-song>
|
></app-song>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -64,9 +64,8 @@ export class ShowComponent implements OnInit {
|
|||||||
event.source.value = null;
|
event.source.value = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public getSong(songs: Song[], songId: string): Song {
|
public getSong(songId: string): Song {
|
||||||
if (!songs) return null;
|
const filtered = this.songs.filter(_ => _.id === songId);
|
||||||
const filtered = songs.filter(_ => _.id === songId);
|
|
||||||
return filtered.length > 0 ? filtered[0] : null;
|
return filtered.length > 0 ? filtered[0] : null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ export class SongComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public async reorderUp(): Promise<void> {
|
public async reorderUp(): Promise<void> {
|
||||||
const index = this.showSongs.findIndex(_ => _.songId === this.song.id);
|
const index = this.showSongs.findIndex(_ => _.songId === this._song.id);
|
||||||
if (index === 0) return;
|
if (index === 0) return;
|
||||||
|
|
||||||
const song = this.showSongs[index];
|
const song = this.showSongs[index];
|
||||||
@@ -65,7 +65,7 @@ export class SongComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public async reorderDown(): Promise<void> {
|
public async reorderDown(): Promise<void> {
|
||||||
const index = this.showSongs.findIndex(_ => _.songId === this.song.id);
|
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 song = this.showSongs[index];
|
||||||
|
|||||||
Reference in New Issue
Block a user