import { Component, OnInit } from '@angular/core'; import { NGXLogger } from 'ngx-logger'; import { ucapAnimations, DialogService } from '@ucap-webmessenger/ui'; import { CreateChatDialogComponent, CreateChatDialogData, CreateChatDialogResult } from '@app/layouts/messenger/dialogs/chat/create-chat.dialog.component'; import { Observable } from 'rxjs'; import { Store, select } from '@ngrx/store'; import * as AppStore from '@app/store'; @Component({ selector: 'app-layout-messenger-left-side', templateUrl: './left-side.component.html', styleUrls: ['./left-side.component.scss'], animations: ucapAnimations }) export class LeftSideComponent implements OnInit { badgeChatUnReadCount$: Observable; constructor( private store: Store, private dialogService: DialogService, private logger: NGXLogger ) {} ngOnInit() { this.badgeChatUnReadCount$ = this.store.pipe( select(AppStore.MessengerSelector.SyncSelector.selectChatUnreadCount) ); } async onClickNewChat() { const result = await this.dialogService.open< CreateChatDialogComponent, CreateChatDialogData, CreateChatDialogResult >(CreateChatDialogComponent, { width: '500px', height: '500px', data: { title: 'New Chat' } }); this.logger.debug(result.choice); // if (result.choice) { // } else { // } } }