changes acc. user intro + chdet for move image

This commit is contained in:
2025-01-19 11:55:23 +00:00
parent 83035a6b82
commit 9638feacb9
4 changed files with 58 additions and 61 deletions

View File

@@ -69,6 +69,9 @@ export class DeckListComponent implements OnInit {
if (!this.activeDeck && this.decks.length > 0) {
this.activeDeck = this.decks[0];
}
if (this.decks.length === 0) {
this.activeDeck = null;
}
},
error: err => console.error('Error loading decks', err),
});
@@ -100,7 +103,7 @@ export class DeckListComponent implements OnInit {
next: () => {
this.loadDecks();
this.closeDeletePopover();
this.activeDeck = this.decks[0];
this.activeDeck = this.decks.length > 0 ? this.decks[0] : null;
},
error: err => console.error('Error deleting deck', err),
});
@@ -314,7 +317,21 @@ export class DeckListComponent implements OnInit {
// Handler for the moveCompleted event
onImageMoved(): void {
this.imageToMove = null;
this.loadDecks();
// Speichere den Namen des aktiven Decks
const activeDeckName = this.activeDeck?.name;
this.deckService.getDecks().subscribe({
next: decks => {
this.decks = decks;
// Aktualisiere den activeDeck mit den neuen Daten
if (activeDeckName) {
this.activeDeck = this.decks.find(deck => deck.name === activeDeckName) || null;
}
// Force change detection
this.cdr.detectChanges();
},
error: err => console.error('Error loading decks', err),
});
}
onFileChange(event: any): void {