fix: update toggleSelect to select only 4 authors
LocationBasedServices/smartguide/pipeline/head This commit looks good
LocationBasedServices/smartguide/pipeline/pr-dev Build queued...

This commit is contained in:
Steven Tischer
2026-08-22 13:34:47 +02:00
parent d719a34ab0
commit bbce780609
2 changed files with 11 additions and 3 deletions
@@ -29,7 +29,7 @@
<mat-checkbox
class="author-select"
[checked]="isSelected(author)"
(change)="toggleSelect(author)" />
(change)="toggleSelect(author, $event)" />
<a
class="author-name"
[routerLink]="['/person', authorProfileId(author), 'overview']">
@@ -6,7 +6,10 @@ import { DecimalPipe } from '@angular/common';
import { ActivatedRoute, Router, RouterLink } from '@angular/router';
import { MatButtonModule } from '@angular/material/button';
import { MatCardModule } from '@angular/material/card';
import { MatCheckboxModule } from '@angular/material/checkbox';
import {
MatCheckboxChange,
MatCheckboxModule,
} from '@angular/material/checkbox';
import { MatIconModule } from '@angular/material/icon';
import { MatSnackBar } from '@angular/material/snack-bar';
import { FormsModule } from '@angular/forms';
@@ -466,7 +469,7 @@ export class KeywordsToPersonsResultsComponent implements OnInit {
return this.selectedIds().includes(this.authorProfileId(author));
}
toggleSelect(author: RankedAuthor): void {
toggleSelect(author: RankedAuthor, event?: MatCheckboxChange): void {
const id = this.authorProfileId(author);
const current = this.selectedIds();
@@ -476,6 +479,11 @@ export class KeywordsToPersonsResultsComponent implements OnInit {
}
if (current.length >= this.MAX_SELECTED) {
// the checkbox already toggled itself, so revert it: the [checked] input
// does not change here and would leave the box visually ticked
if (event) {
event.source.checked = false;
}
this.snackBar.open(
`Es können maximal ${this.MAX_SELECTED} Autoren verglichen werden.`,
'OK',