Skip to content
Snippets Groups Projects
Commit 67fc1ee7 authored by Lukas Mauß's avatar Lukas Mauß
Browse files

Fix comment counter

parent 0214748b
1 merge request!218Resolve "Some bugs concerning the counting badge"
Pipeline #27060 passed with stages
in 6 minutes and 58 seconds
...@@ -14,8 +14,8 @@ ...@@ -14,8 +14,8 @@
<div class="button-bar" fxLayoutAlign="center center"> <div class="button-bar" fxLayoutAlign="center center">
<div *ngIf="comments && comments.length > 0"> <div *ngIf="comments && comments.length > 0">
<mat-chip-list> <mat-chip-list>
<mat-chip class="comment-counter" *ngIf="(!filteredComments) || (comments.length === filteredComments.length)">{{comments.length}}</mat-chip> <mat-chip class="counter" *ngIf="comments && !hideCommentsList">{{comments.length}}</mat-chip>
<mat-chip class="comment-counter" *ngIf="(filteredComments) && (comments.length > filteredComments.length)">{{filteredComments.length}}</mat-chip> <mat-chip class="counter counter-filtered" *ngIf="filteredComments && hideCommentsList">{{filteredComments.length}}</mat-chip>
</mat-chip-list> </mat-chip-list>
</div> </div>
...@@ -67,7 +67,7 @@ ...@@ -67,7 +67,7 @@
<mat-icon [ngClass]="{unread: 'unread-icon'}[currentFilter]">visibility_off</mat-icon> <mat-icon [ngClass]="{unread: 'unread-icon'}[currentFilter]">visibility_off</mat-icon>
</button> </button>
<button mat-icon-button (focus)="hideCommentsList=false" (click)="sortComments(currentSort)"> <button mat-icon-button (focus)="hideCommentsList=false" (click)="sortComments(currentSort); filterComments('')">
<mat-icon>close</mat-icon> <mat-icon>close</mat-icon>
</button> </button>
</div> </div>
......
...@@ -80,8 +80,15 @@ h4 { ...@@ -80,8 +80,15 @@ h4 {
color: var(--yellow); color: var(--yellow);
} }
.comment-counter { .counter {
font-size: 18pt; font-size: 18pt;
background-color: var(--primary);
color: var(--on-primary);
}
.counter-filtered {
background-color: var(--secondary);
color: var(--on-secondary);
} }
.up { .up {
......
...@@ -182,6 +182,10 @@ export class CommentListComponent implements OnInit { ...@@ -182,6 +182,10 @@ export class CommentListComponent implements OnInit {
filterComments(type: string): void { filterComments(type: string): void {
this.currentFilter = type; this.currentFilter = type;
if (type === '') {
this.filteredComments = this.comments;
return;
}
this.filteredComments = this.comments.filter(c => { this.filteredComments = this.comments.filter(c => {
switch (type) { switch (type) {
case this.correct: case this.correct:
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment