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

Fix sort-icon effects

parent e9566526
No related merge requests found
......@@ -35,14 +35,14 @@
<mat-menu #sortMenu="matMenu" xPosition="before">
<button mat-icon-button (focus)="hideCommentsList=false" (click)="sortComments(votedesc)">
<mat-icon>arrow_upwards</mat-icon>
<mat-icon>keyboard_arrow_up</mat-icon>
</button>
<button mat-icon-button (focus)="hideCommentsList=false" (click)="sortComments(voteasc)">
<mat-icon>arrow_downwards</mat-icon>
<mat-icon>keyboard_arrow_down</mat-icon>
</button>
<button mat-icon-button (focus)="hideCommentsList=false" (click)="sortComments(currentSort === timedesc ? timeasc : timedesc)">
<button mat-icon-button (focus)="hideCommentsList=false" (click)="sortComments(time)">
<mat-icon>access_time</mat-icon>
</button>
</mat-menu>
......
......@@ -31,8 +31,7 @@ export class CommentListComponent implements OnInit {
isLoading = true;
voteasc = 'vote_asc';
votedesc = 'vote_desc';
timeasc = 'time_asc';
timedesc = 'time_desc';
time = 'time';
currentSort = this.votedesc;
read = 'read';
unread = 'unread';
......@@ -205,9 +204,7 @@ export class CommentListComponent implements OnInit {
return b.score - a.score;
}
const dateA = new Date(a.timestamp), dateB = new Date(b.timestamp);
if (type === this.timedesc) {
return +dateA - +dateB;
} else {
if (type === this.time) {
return +dateB - +dateA;
}
});
......
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