Commit 2f0134fa authored by Ruben Bimberg's avatar Ruben Bimberg 💻
Browse files

Implement important snackbar messages

parent 8339a4cd
Pipeline #70034 passed with stages
in 12 minutes and 5 seconds
......@@ -10,6 +10,7 @@ import { CommentService } from '../services/http/comment.service';
import { observable, Observable, of } from 'rxjs';
import { flatMap } from 'rxjs/internal/operators';
import { tap } from 'rxjs/operators';
import { MatSnackBarConfig } from '@angular/material/snack-bar';
export class CreateCommentWrapper {
constructor(private translateService: TranslateService,
......@@ -36,6 +37,9 @@ export class CreateCommentWrapper {
send(comment: Comment): Observable<Comment> {
let message;
const config: MatSnackBarConfig = {
panelClass: ['snackbar']
};
if (this.room.directSend) {
this.translateService.get('comment-list.comment-sent').subscribe(msg => {
message = msg;
......@@ -44,10 +48,11 @@ export class CreateCommentWrapper {
} else {
this.translateService.get('comment-list.comment-sent-to-moderator').subscribe(msg => {
message = msg;
(config.panelClass as string[]).push('important');
});
}
return this.commentService.addComment(comment).pipe(
tap(() => this.notificationService.show(message))
tap(() => this.notificationService.show(message, null, config))
);
}
}
......@@ -19,6 +19,12 @@ mat-form-field.input-block {
color: var(--on-secondary);
}
.snackbar.important {
background-color: var(--red);
color: var(--white);
font-weight: bolder;
}
.snackbar button {
background-color: var(--primary);
color: var(--on-primary) !important;
......
Markdown is supported
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