diff --git a/src/app/components/shared/comment/comment.component.html b/src/app/components/shared/comment/comment.component.html index b694fb287f1333a0598ca2f92aff6150488bf5b0..dfd9385982dbb9080d205848db1b6ad86c681928 100644 --- a/src/app/components/shared/comment/comment.component.html +++ b/src/app/components/shared/comment/comment.component.html @@ -5,6 +5,9 @@ <button mat-icon-button [disabled]="userRole === 0" (click)="setCorrect(comment)" [matTooltip]="comment.correct ? 'Antwort richtig' : null"> <mat-icon [ngClass]="{'correct-icon' : comment.correct === true}">check_circle</mat-icon> </button> + <button mat-icon-button [disabled]="userRole === 0" (click)="setFavorite(comment)" [matTooltip]="comment.favorite ? 'mark as favorite' : 'mark as not favorite'"> + <mat-icon [ngClass]="{'favorite-icon' : comment.favorite === true}">star</mat-icon> + </button> <button mat-icon-button [disabled]="userRole === 0" (click)="setRead(comment)" [matTooltip]="comment.read ? 'mark me as unread' : 'mark me as read'"> <mat-icon [ngClass]="{'read-icon' : comment.read === true}">visibility</mat-icon> </button> diff --git a/src/app/components/shared/comment/comment.component.scss b/src/app/components/shared/comment/comment.component.scss index f93c041fba9e554ad696b0a1d2415554d2e0ae8c..5b2b2e943000acee64474d83954a59110c35fb67 100644 --- a/src/app/components/shared/comment/comment.component.scss +++ b/src/app/components/shared/comment/comment.component.scss @@ -25,3 +25,7 @@ mat-icon { .read-icon { color: blue; } + +.favorite-icon { + color: #fdd835; +} diff --git a/src/app/components/shared/comment/comment.component.ts b/src/app/components/shared/comment/comment.component.ts index 2b31914103606a72f5a253d26e587f39de27fd63..1178377c1dab0fb92f1cc29d8e4a194c09ec7159 100644 --- a/src/app/components/shared/comment/comment.component.ts +++ b/src/app/components/shared/comment/comment.component.ts @@ -43,6 +43,11 @@ export class CommentComponent implements OnInit { this.commentService.updateComment(comment).subscribe(); } + setFavorite(comment: Comment): void { + comment.favorite = !comment.favorite; + this.commentService.updateComment(comment).subscribe(); + } + delete(comment: Comment): void { this.commentService.deleteComment(comment.id).subscribe(room => { this.notification.show(`Comment '${comment.subject}' successfully deleted.`);