feat: remove players

This commit is contained in:
eneller
2026-01-31 21:05:23 +01:00
parent 4082932095
commit aaa0ab0638
6 changed files with 32 additions and 1 deletions

View File

@@ -35,6 +35,7 @@
],
"styles": [
"node_modules/bootstrap/dist/css/bootstrap.min.css",
"node_modules/bootstrap-icons/font/bootstrap-icons.min.css",
"src/styles.less"
],
"scripts": [],

17
package-lock.json generated
View File

@@ -23,6 +23,7 @@
"@ng-bootstrap/ng-bootstrap": "^18.0.0",
"@popperjs/core": "^2.11.8",
"bootstrap": "^5.3.3",
"bootstrap-icons": "^1.13.1",
"express": "^4.18.2",
"rxjs": "~7.8.0",
"sonarqube-scanner": "^4.3.0",
@@ -6249,6 +6250,22 @@
"@popperjs/core": "^2.11.8"
}
},
"node_modules/bootstrap-icons": {
"version": "1.13.1",
"resolved": "https://registry.npmjs.org/bootstrap-icons/-/bootstrap-icons-1.13.1.tgz",
"integrity": "sha512-ijombt4v6bv5CLeXvRWKy7CuM3TRTuPEuGaGKvTV5cz65rQSY8RQ2JcHt6b90cBBAC7s8fsf2EkQDldzCoXUjw==",
"funding": [
{
"type": "github",
"url": "https://github.com/sponsors/twbs"
},
{
"type": "opencollective",
"url": "https://opencollective.com/bootstrap"
}
],
"license": "MIT"
},
"node_modules/brace-expansion": {
"version": "1.1.11",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",

View File

@@ -27,6 +27,7 @@
"@ng-bootstrap/ng-bootstrap": "^18.0.0",
"@popperjs/core": "^2.11.8",
"bootstrap": "^5.3.3",
"bootstrap-icons": "^1.13.1",
"express": "^4.18.2",
"rxjs": "~7.8.0",
"sonarqube-scanner": "^4.3.0",

View File

@@ -18,6 +18,12 @@ export class DataService {
}
return false
}
removePlayer(player: Player){
const index = this.players.indexOf(player);
if (index !== -1) {
this.players.splice(index, 1);
}
}
getPlayers(): Player[] {
let clone =Object.assign([],this.players);
return clone

View File

@@ -18,8 +18,11 @@
<div class="container mt-4">
<ul class="list-group mb-3">
@for (player of data.getPlayers(); track $index) {
<li class="list-group-item">
<li class="list-group-item d-flex justify-content-between">
<a (click)="openPlayerModal(player)" style="display: block; cursor: pointer;">{{ player.name }}</a>
<button (click)="removeItem(player)" class="btn btn-secondary btn-sm p-0" style="width: 24px; height: 24px" >
<i class="bi bi-x"></i>
</button>
</li>
}
</ul>

View File

@@ -44,6 +44,9 @@ export class ScreenEditComponent {
}
}
}
removeItem(player: Player){
this.data.removePlayer(player);
}
openPlayerModal(player: Player){
const modalRef = this.modalService.open(ModalRotationsComponent);