Skip to content

Commit

Permalink
Show indication when no labels are found (#183)
Browse files Browse the repository at this point in the history
Show indication when no labels are found

Previously, when no labels are found, there was no indication.

Let's
* Show an indication when no labels match the input
* Show an indication when the repository has no labels
  • Loading branch information
seetohjinwei authored Jul 23, 2023
1 parent db60241 commit cbf8c82
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -123,3 +123,9 @@
mat-list-option {
width: max-content;
}

.no-labels {
/* Chosen to look similar to button above. */
padding: 0 16px;
font-size: 14px;
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

<button mat-button (click)="removeAllSelection()">Remove all</button>

<div *ngIf="!hasLabels(input.value)" class="no-labels">No Labels Found!</div>
<div class="scroll-container-wrapper">
<div class="scroll-container">
<mat-selection-list [(ngModel)]="selectedLabelNames" (selectionChange)="updateSelection()">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,13 @@ export class LabelFilterBarComponent implements OnInit, OnDestroy {
return !target.toLowerCase().includes(filter.toLowerCase());
}

hasLabels(filter: string): boolean {
if (this.allLabels === undefined || this.allLabels.length === 0) {
return false;
}
return this.allLabels.some((label) => !this.filter(filter, label.name));
}

updateSelection(): void {
this.selectedLabels.next(this.selectedLabelNames);
}
Expand Down

0 comments on commit cbf8c82

Please sign in to comment.