From 88844fa42b225d1e50c1d1343577d5ffa9bcf194 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lukas=20Mau=C3=9F?= <lukas.mauss@mni.thm.de> Date: Mon, 10 Jun 2019 12:48:01 +0200 Subject: [PATCH] Fix sort-icon effects --- .../shared/comment-list/comment-list.component.html | 6 +++--- .../shared/comment-list/comment-list.component.ts | 7 ++----- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/app/components/shared/comment-list/comment-list.component.html b/src/app/components/shared/comment-list/comment-list.component.html index cf32c8a66..a03d29cdc 100644 --- a/src/app/components/shared/comment-list/comment-list.component.html +++ b/src/app/components/shared/comment-list/comment-list.component.html @@ -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> diff --git a/src/app/components/shared/comment-list/comment-list.component.ts b/src/app/components/shared/comment-list/comment-list.component.ts index dae81293f..8e313d94a 100644 --- a/src/app/components/shared/comment-list/comment-list.component.ts +++ b/src/app/components/shared/comment-list/comment-list.component.ts @@ -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; } }); -- GitLab