feat: deduplicated player adding

This commit is contained in:
eneller
2026-01-31 15:52:06 +01:00
parent 5408a8d9b6
commit 1bc97df0da
9 changed files with 131 additions and 58 deletions

View File

@@ -2,8 +2,6 @@
import { Component, Input } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { Player } from '../model';
import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
import { ModalRotationsComponent } from '../modal-rotations/modal-rotations.component';
@Component({
selector: 'app-screen-rotations',
@@ -13,28 +11,4 @@ import { ModalRotationsComponent } from '../modal-rotations/modal-rotations.comp
})
export class ScreenRotationsComponent {
@Input() players!: Player[];
newItem: string = "";
constructor(private modalService: NgbModal) {}
addItem() {
if (this.newItem.trim()) {
this.players.push( new Player(this.newItem));
this.newItem = "";
}
}
openPlayerModal(player: Player){
const modalRef = this.modalService.open(ModalRotationsComponent);
modalRef.componentInstance.player = player;
/*
modalRef.result.then((updatedPlayer) => {
// Handle the updated player data if needed
console.log('Player updated:', updatedPlayer);
}).catch((error) => {
console.log('Modal dismissed');
});
*/
}
}