replace alerts und confirms with modals #15

This commit is contained in:
Your Name
2025-01-28 16:33:34 +01:00
parent 47b393e134
commit 2f35648264
8 changed files with 274 additions and 188 deletions

View File

@@ -1,13 +1,14 @@
import { Component, Input, Output, EventEmitter } from '@angular/core';
import { CommonModule } from '@angular/common';
import { Component, EventEmitter, Input, Output } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { DeckImage, Deck, DeckService } from '../deck.service';
import { Deck, DeckImage, DeckService } from '../deck.service';
import { PopoverService } from '../services/popover.service';
@Component({
selector: 'app-move-image-modal',
templateUrl: './move-image-modal.component.html',
standalone: true,
imports: [CommonModule, FormsModule]
imports: [CommonModule, FormsModule],
})
export class MoveImageModalComponent {
@Input() image!: DeckImage;
@@ -18,7 +19,7 @@ export class MoveImageModalComponent {
selectedDeckId: number | null = null;
constructor(private deckService: DeckService) { }
constructor(private deckService: DeckService, private popoverService: PopoverService) {}
moveImage(): void {
if (this.selectedDeckId === null) {
@@ -30,14 +31,17 @@ export class MoveImageModalComponent {
this.moveCompleted.emit();
this.close();
},
error: (err) => {
error: err => {
console.error('Error moving image:', err);
alert('Error moving image.');
}
this.popoverService.show({
title: 'Error',
message: 'Error moving image.',
});
},
});
}
close(): void {
this.closed.emit();
}
}
}