diff --git a/src/app/modules/admin/apps/chat/chats/chats.component.html b/src/app/modules/admin/apps/chat/chats/chats.component.html index bcab6292..440c18a7 100644 --- a/src/app/modules/admin/apps/chat/chats/chats.component.html +++ b/src/app/modules/admin/apps/chat/chats/chats.component.html @@ -6,7 +6,7 @@ @@ -28,7 +28,7 @@ -
+
@@ -176,9 +176,9 @@
+ 'hidden lg:flex': !selectedChat || !selectedChat.id}">
diff --git a/src/app/modules/admin/apps/chat/conversation/conversation.component.html b/src/app/modules/admin/apps/chat/conversation/conversation.component.html index 9c3fa082..fd1cce18 100644 --- a/src/app/modules/admin/apps/chat/conversation/conversation.component.html +++ b/src/app/modules/admin/apps/chat/conversation/conversation.component.html @@ -8,9 +8,9 @@ diff --git a/src/app/modules/admin/apps/chat/conversation/conversation.component.ts b/src/app/modules/admin/apps/chat/conversation/conversation.component.ts index 89ce4752..9bd0c4f9 100644 --- a/src/app/modules/admin/apps/chat/conversation/conversation.component.ts +++ b/src/app/modules/admin/apps/chat/conversation/conversation.component.ts @@ -1,6 +1,7 @@ import { ChangeDetectionStrategy, ChangeDetectorRef, Component, ElementRef, HostListener, NgZone, OnDestroy, OnInit, ViewChild, ViewEncapsulation } from '@angular/core'; import { Subject } from 'rxjs'; import { takeUntil } from 'rxjs/operators'; +import { FuseMediaWatcherService } from '@fuse/services/media-watcher'; import { Chat } from 'app/modules/admin/apps/chat/chat.types'; import { ChatService } from 'app/modules/admin/apps/chat/chat.service'; @@ -14,6 +15,7 @@ export class ConversationComponent implements OnInit, OnDestroy { @ViewChild('messageInput') messageInput: ElementRef; chat: Chat; + drawerMode: 'over' | 'side' = 'side'; drawerOpened: boolean = false; private _unsubscribeAll: Subject = new Subject(); @@ -23,6 +25,7 @@ export class ConversationComponent implements OnInit, OnDestroy constructor( private _changeDetectorRef: ChangeDetectorRef, private _chatService: ChatService, + private _fuseMediaWatcherService: FuseMediaWatcherService, private _ngZone: NgZone ) { @@ -43,6 +46,25 @@ export class ConversationComponent implements OnInit, OnDestroy .subscribe((chat: Chat) => { this.chat = chat; + // Mark for check + this._changeDetectorRef.markForCheck(); + }); + + // Subscribe to media changes + this._fuseMediaWatcherService.onMediaChange$ + .pipe(takeUntil(this._unsubscribeAll)) + .subscribe(({matchingAliases}) => { + + // Set the drawerMode if the given breakpoint is active + if ( matchingAliases.includes('lg') ) + { + this.drawerMode = 'side'; + } + else + { + this.drawerMode = 'over'; + } + // Mark for check this._changeDetectorRef.markForCheck(); }); @@ -81,6 +103,9 @@ export class ConversationComponent implements OnInit, OnDestroy { this._chatService.resetChat(); + // Close the contact info in case it's opened + this.drawerOpened = false; + // Mark for check this._changeDetectorRef.markForCheck(); }