diff --git a/src/app/modules/admin/apps/chat/chat.component.html b/src/app/modules/admin/apps/chat/chat.component.html deleted file mode 100644 index 09f50e82..00000000 --- a/src/app/modules/admin/apps/chat/chat.component.html +++ /dev/null @@ -1,8 +0,0 @@ -
- - -
- -
- -
diff --git a/src/app/modules/admin/apps/chat/chat.component.ts b/src/app/modules/admin/apps/chat/chat.component.ts deleted file mode 100644 index 15583229..00000000 --- a/src/app/modules/admin/apps/chat/chat.component.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { ChangeDetectionStrategy, Component, ViewEncapsulation } from '@angular/core'; - -@Component({ - selector : 'chat', - templateUrl : './chat.component.html', - encapsulation : ViewEncapsulation.None, - changeDetection: ChangeDetectionStrategy.OnPush -}) -export class ChatComponent -{ - /** - * Constructor - */ - constructor() - { - } -} diff --git a/src/app/modules/admin/apps/chat/chat.module.ts b/src/app/modules/admin/apps/chat/chat.module.ts deleted file mode 100644 index 42125e37..00000000 --- a/src/app/modules/admin/apps/chat/chat.module.ts +++ /dev/null @@ -1,44 +0,0 @@ -import { NgModule } from '@angular/core'; -import { RouterModule } from '@angular/router'; -import { MatButtonModule } from '@angular/material/button'; -import { MatCheckboxModule } from '@angular/material/checkbox'; -import { MatFormFieldModule } from '@angular/material/form-field'; -import { MatIconModule } from '@angular/material/icon'; -import { MatInputModule } from '@angular/material/input'; -import { MatMenuModule } from '@angular/material/menu'; -import { MatSidenavModule } from '@angular/material/sidenav'; -import { FuseAutogrowModule } from '@fuse/directives/autogrow'; -import { SharedModule } from 'app/shared/shared.module'; -import { chatRoutes } from 'app/modules/admin/apps/chat/chat.routing'; -import { ChatComponent } from 'app/modules/admin/apps/chat/chat.component'; -import { ChatsComponent } from 'app/modules/admin/apps/chat/chats/chats.component'; -import { ContactInfoComponent } from 'app/modules/admin/apps/chat/contact-info/contact-info.component'; -import { ConversationComponent } from 'app/modules/admin/apps/chat/conversation/conversation.component'; -import { NewChatComponent } from 'app/modules/admin/apps/chat/new-chat/new-chat.component'; -import { ProfileComponent } from 'app/modules/admin/apps/chat/profile/profile.component'; - -@NgModule({ - declarations: [ - ChatComponent, - ChatsComponent, - ContactInfoComponent, - ConversationComponent, - NewChatComponent, - ProfileComponent - ], - imports: [ - RouterModule.forChild(chatRoutes), - MatButtonModule, - MatCheckboxModule, - MatFormFieldModule, - MatIconModule, - MatInputModule, - MatMenuModule, - MatSidenavModule, - FuseAutogrowModule, - SharedModule, - ] -}) -export class ChatModule -{ -} diff --git a/src/app/modules/admin/apps/chat/chat.resolvers.ts b/src/app/modules/admin/apps/chat/chat.resolvers.ts deleted file mode 100644 index 54a377f6..00000000 --- a/src/app/modules/admin/apps/chat/chat.resolvers.ts +++ /dev/null @@ -1,147 +0,0 @@ -import { Injectable } from '@angular/core'; -import { ActivatedRouteSnapshot, Resolve, Router, RouterStateSnapshot } from '@angular/router'; -import { Observable, throwError } from 'rxjs'; -import { catchError } from 'rxjs/operators'; -import { ChatService } from 'app/modules/admin/apps/chat/chat.service'; -import { Chat, Contact, Profile } from 'app/modules/admin/apps/chat/chat.types'; - -@Injectable({ - providedIn: 'root' -}) -export class ChatChatsResolver implements Resolve -{ - /** - * Constructor - */ - constructor( - private _chatService: ChatService, - private _router: Router - ) - { - } - - // ----------------------------------------------------------------------------------------------------- - // @ Public methods - // ----------------------------------------------------------------------------------------------------- - - /** - * Resolver - * - * @param route - * @param state - */ - resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable | any - { - return this._chatService.getChats(); - } -} - -@Injectable({ - providedIn: 'root' -}) -export class ChatChatResolver implements Resolve -{ - /** - * Constructor - */ - constructor( - private _chatService: ChatService, - private _router: Router - ) - { - } - - // ----------------------------------------------------------------------------------------------------- - // @ Public methods - // ----------------------------------------------------------------------------------------------------- - - /** - * Resolver - * - * @param route - * @param state - */ - resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable - { - return this._chatService.getChatById(route.paramMap.get('id')) - .pipe( - // Error here means the requested chat is not available - catchError((error) => { - - // Log the error - console.error(error); - - // Get the parent url - const parentUrl = state.url.split('/').slice(0, -1).join('/'); - - // Navigate to there - this._router.navigateByUrl(parentUrl); - - // Throw an error - return throwError(error); - }) - ); - } -} - -@Injectable({ - providedIn: 'root' -}) -export class ChatContactsResolver implements Resolve -{ - /** - * Constructor - */ - constructor( - private _chatService: ChatService, - private _router: Router - ) - { - } - - // ----------------------------------------------------------------------------------------------------- - // @ Public methods - // ----------------------------------------------------------------------------------------------------- - - /** - * Resolver - * - * @param route - * @param state - */ - resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable | any - { - return this._chatService.getContacts(); - } -} - -@Injectable({ - providedIn: 'root' -}) -export class ChatProfileResolver implements Resolve -{ - /** - * Constructor - */ - constructor( - private _chatService: ChatService, - private _router: Router - ) - { - } - - // ----------------------------------------------------------------------------------------------------- - // @ Public methods - // ----------------------------------------------------------------------------------------------------- - - /** - * Resolver - * - * @param route - * @param state - */ - resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable | any - { - return this._chatService.getProfile(); - } -} diff --git a/src/app/modules/admin/apps/chat/chat.routing.ts b/src/app/modules/admin/apps/chat/chat.routing.ts deleted file mode 100644 index caa84979..00000000 --- a/src/app/modules/admin/apps/chat/chat.routing.ts +++ /dev/null @@ -1,37 +0,0 @@ -import { Route } from '@angular/router'; -import { ChatChatResolver, ChatChatsResolver, ChatContactsResolver, ChatProfileResolver } from 'app/modules/admin/apps/chat/chat.resolvers'; -import { ChatComponent } from 'app/modules/admin/apps/chat/chat.component'; -import { ChatsComponent } from 'app/modules/admin/apps/chat/chats/chats.component'; -import { ConversationComponent } from 'app/modules/admin/apps/chat/conversation/conversation.component'; - -export const chatRoutes: Route[] = [ - { - path : '', - component: ChatComponent, - resolve : { - chats : ChatChatsResolver, - contacts: ChatContactsResolver, - profile : ChatProfileResolver - }, - children : [ - { - path : '', - component: ChatsComponent, - children : [ - { - path : '', - component: ConversationComponent, - children : [ - { - path : ':id', - resolve: { - conversation: ChatChatResolver - } - } - ] - } - ] - } - ] - } -]; diff --git a/src/app/modules/admin/apps/chat/chat.service.ts b/src/app/modules/admin/apps/chat/chat.service.ts deleted file mode 100644 index 057e0061..00000000 --- a/src/app/modules/admin/apps/chat/chat.service.ts +++ /dev/null @@ -1,202 +0,0 @@ -import { Injectable } from '@angular/core'; -import { HttpClient } from '@angular/common/http'; -import { BehaviorSubject, Observable, of, throwError } from 'rxjs'; -import { filter, map, switchMap, take, tap } from 'rxjs/operators'; -import { Chat, Contact, Profile } from 'app/modules/admin/apps/chat/chat.types'; - -@Injectable({ - providedIn: 'root' -}) -export class ChatService -{ - private _chat: BehaviorSubject = new BehaviorSubject(null); - private _chats: BehaviorSubject = new BehaviorSubject(null); - private _contact: BehaviorSubject = new BehaviorSubject(null); - private _contacts: BehaviorSubject = new BehaviorSubject(null); - private _profile: BehaviorSubject = new BehaviorSubject(null); - - /** - * Constructor - */ - constructor(private _httpClient: HttpClient) - { - } - - // ----------------------------------------------------------------------------------------------------- - // @ Accessors - // ----------------------------------------------------------------------------------------------------- - - /** - * Getter for chat - */ - get chat$(): Observable - { - return this._chat.asObservable(); - } - - /** - * Getter for chats - */ - get chats$(): Observable - { - return this._chats.asObservable(); - } - - /** - * Getter for contact - */ - get contact$(): Observable - { - return this._contact.asObservable(); - } - - /** - * Getter for contacts - */ - get contacts$(): Observable - { - return this._contacts.asObservable(); - } - - /** - * Getter for profile - */ - get profile$(): Observable - { - return this._profile.asObservable(); - } - - // ----------------------------------------------------------------------------------------------------- - // @ Public methods - // ----------------------------------------------------------------------------------------------------- - - /** - * Get chats - */ - getChats(): Observable - { - return this._httpClient.get('api/apps/chat/chats').pipe( - tap((response: Chat[]) => { - this._chats.next(response); - }) - ); - } - - /** - * Get contact - * - * @param id - */ - getContact(id: string): Observable - { - return this._httpClient.get('api/apps/chat/contacts', {params: {id}}).pipe( - tap((response: Contact) => { - this._contact.next(response); - }) - ); - } - - /** - * Get contacts - */ - getContacts(): Observable - { - return this._httpClient.get('api/apps/chat/contacts').pipe( - tap((response: Contact[]) => { - this._contacts.next(response); - }) - ); - } - - /** - * Get profile - */ - getProfile(): Observable - { - return this._httpClient.get('api/apps/chat/profile').pipe( - tap((response: Profile) => { - this._profile.next(response); - }) - ); - } - - /** - * Get chat - * - * @param id - */ - getChatById(id: string): Observable - { - return this._httpClient.get('api/apps/chat/chat', {params: {id}}).pipe( - map((chat) => { - - // Update the chat - this._chat.next(chat); - - // Return the chat - return chat; - }), - switchMap((chat) => { - - if ( !chat ) - { - return throwError('Could not found chat with id of ' + id + '!'); - } - - return of(chat); - }) - ); - } - - /** - * Update chat - * - * @param id - * @param chat - */ - updateChat(id: string, chat: Chat): Observable - { - return this.chats$.pipe( - take(1), - switchMap(chats => this._httpClient.patch('api/apps/chat/chat', { - id, - chat - }).pipe( - map((updatedChat) => { - - // Find the index of the updated chat - const index = chats.findIndex(item => item.id === id); - - // Update the chat - chats[index] = updatedChat; - - // Update the chats - this._chats.next(chats); - - // Return the updated contact - return updatedChat; - }), - switchMap(updatedChat => this.chat$.pipe( - take(1), - filter(item => item && item.id === id), - tap(() => { - - // Update the chat if it's selected - this._chat.next(updatedChat); - - // Return the updated chat - return updatedChat; - }) - )) - )) - ); - } - - /** - * Reset the selected chat - */ - resetChat(): void - { - this._chat.next(null); - } -} diff --git a/src/app/modules/admin/apps/chat/chat.types.ts b/src/app/modules/admin/apps/chat/chat.types.ts deleted file mode 100644 index dededb11..00000000 --- a/src/app/modules/admin/apps/chat/chat.types.ts +++ /dev/null @@ -1,55 +0,0 @@ -export interface Profile -{ - id?: string; - name?: string; - email?: string; - avatar?: string; - about?: string; -} - -export interface Contact -{ - id?: string; - avatar?: string; - name?: string; - about?: string; - details?: { - emails?: { - email?: string; - label?: string; - }[]; - phoneNumbers?: { - country?: string; - number?: string; - label?: string; - }[]; - title?: string; - company?: string; - birthday?: string; - address?: string; - }; - attachments?: { - media?: any[] - docs?: any[] - links?: any[] - }; -} - -export interface Chat -{ - id?: string; - contactId?: string; - contact?: Contact; - unreadCount?: number; - muted?: boolean; - lastMessage?: string; - lastMessageAt?: string; - messages?: { - id?: string; - chatId?: string; - contactId?: string; - isMine?: boolean; - value?: string; - createdAt?: string; - }[]; -} diff --git a/src/app/modules/admin/apps/chat/chats/chats.component.html b/src/app/modules/admin/apps/chat/chats/chats.component.html deleted file mode 100644 index bcab6292..00000000 --- a/src/app/modules/admin/apps/chat/chats/chats.component.html +++ /dev/null @@ -1,190 +0,0 @@ -
- - - - - - - - - - - - - - - - - - - - - - - -
- - -
-
-
-
- - Profile avatar - - -
- {{profile.name.charAt(0)}} -
-
-
-
{{profile.name}}
-
- - - - - - - - - -
- -
- - - - -
-
- - -
- - -
-
- -
-
- - Contact avatar - - -
- {{chat.contact.name.charAt(0)}} -
-
-
-
-
{{chat.contact.name}}
-
- {{chat.lastMessage}} -
-
-
-
{{chat.lastMessageAt}}
- - - -
-
-
-
-
- -
- -
- - - -
- -
No chats
-
-
- - - -
- -
-
- -
- -
- -
diff --git a/src/app/modules/admin/apps/chat/chats/chats.component.ts b/src/app/modules/admin/apps/chat/chats/chats.component.ts deleted file mode 100644 index 2d4c6571..00000000 --- a/src/app/modules/admin/apps/chat/chats/chats.component.ts +++ /dev/null @@ -1,138 +0,0 @@ -import { ChangeDetectionStrategy, ChangeDetectorRef, Component, OnDestroy, OnInit, ViewEncapsulation } from '@angular/core'; -import { Subject } from 'rxjs'; -import { takeUntil } from 'rxjs/operators'; -import { Chat, Profile } from 'app/modules/admin/apps/chat/chat.types'; -import { ChatService } from 'app/modules/admin/apps/chat/chat.service'; - -@Component({ - selector : 'chat-chats', - templateUrl : './chats.component.html', - encapsulation : ViewEncapsulation.None, - changeDetection: ChangeDetectionStrategy.OnPush -}) -export class ChatsComponent implements OnInit, OnDestroy -{ - chats: Chat[]; - drawerComponent: 'profile' | 'new-chat'; - drawerOpened: boolean = false; - filteredChats: Chat[]; - profile: Profile; - selectedChat: Chat; - private _unsubscribeAll: Subject = new Subject(); - - /** - * Constructor - */ - constructor( - private _chatService: ChatService, - private _changeDetectorRef: ChangeDetectorRef - ) - { - } - - // ----------------------------------------------------------------------------------------------------- - // @ Lifecycle hooks - // ----------------------------------------------------------------------------------------------------- - - /** - * On init - */ - ngOnInit(): void - { - // Chats - this._chatService.chats$ - .pipe(takeUntil(this._unsubscribeAll)) - .subscribe((chats: Chat[]) => { - this.chats = this.filteredChats = chats; - - // Mark for check - this._changeDetectorRef.markForCheck(); - }); - - // Profile - this._chatService.profile$ - .pipe(takeUntil(this._unsubscribeAll)) - .subscribe((profile: Profile) => { - this.profile = profile; - - // Mark for check - this._changeDetectorRef.markForCheck(); - }); - - // Selected chat - this._chatService.chat$ - .pipe(takeUntil(this._unsubscribeAll)) - .subscribe((chat: Chat) => { - this.selectedChat = chat; - - // Mark for check - this._changeDetectorRef.markForCheck(); - }); - } - - /** - * On destroy - */ - ngOnDestroy(): void - { - // Unsubscribe from all subscriptions - this._unsubscribeAll.next(); - this._unsubscribeAll.complete(); - } - - // ----------------------------------------------------------------------------------------------------- - // @ Public methods - // ----------------------------------------------------------------------------------------------------- - - /** - * Filter the chats - * - * @param query - */ - filterChats(query: string): void - { - // Reset the filter - if ( !query ) - { - this.filteredChats = this.chats; - return; - } - - this.filteredChats = this.chats.filter((chat) => chat.contact.name.toLowerCase().includes(query.toLowerCase())); - } - - /** - * Open the new chat sidebar - */ - openNewChat(): void - { - this.drawerComponent = 'new-chat'; - this.drawerOpened = true; - - // Mark for check - this._changeDetectorRef.markForCheck(); - } - - /** - * Open the profile sidebar - */ - openProfile(): void - { - this.drawerComponent = 'profile'; - this.drawerOpened = true; - - // Mark for check - this._changeDetectorRef.markForCheck(); - } - - /** - * Track by function for ngFor loops - * - * @param index - * @param item - */ - trackByFn(index: number, item: any): any - { - return item.id || index; - } -} diff --git a/src/app/modules/admin/apps/chat/contact-info/contact-info.component.html b/src/app/modules/admin/apps/chat/contact-info/contact-info.component.html deleted file mode 100644 index 9ea099c8..00000000 --- a/src/app/modules/admin/apps/chat/contact-info/contact-info.component.html +++ /dev/null @@ -1,86 +0,0 @@ -
- - -
- -
Contact info
-
- -
- -
-
- - - - -
- {{chat.contact.name.charAt(0)}} -
-
-
-
{{chat.contact.name}}
-
{{chat.contact.about}}
-
- -
- -
Media
-
- - - -
- -
-
Details
- -
-
Email
-
{{chat.contact.details.emails[0].email}}
-
-
- -
-
Phone number
-
{{chat.contact.details.phoneNumbers[0].number}}
-
-
- -
-
Title
-
{{chat.contact.details.title}}
-
-
- -
-
Company
-
{{chat.contact.details.company}}
-
-
- -
-
Birthday
-
{{chat.contact.details.birthday}}
-
-
- -
-
Address
-
{{chat.contact.details.address}}
-
-
-
-
-
- -
diff --git a/src/app/modules/admin/apps/chat/contact-info/contact-info.component.ts b/src/app/modules/admin/apps/chat/contact-info/contact-info.component.ts deleted file mode 100644 index 9e7d014f..00000000 --- a/src/app/modules/admin/apps/chat/contact-info/contact-info.component.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { ChangeDetectionStrategy, Component, Input, ViewEncapsulation } from '@angular/core'; -import { MatDrawer } from '@angular/material/sidenav'; -import { Chat, Contact } from 'app/modules/admin/apps/chat/chat.types'; - -@Component({ - selector : 'chat-contact-info', - templateUrl : './contact-info.component.html', - encapsulation : ViewEncapsulation.None, - changeDetection: ChangeDetectionStrategy.OnPush -}) -export class ContactInfoComponent -{ - @Input() chat: Chat; - @Input() drawer: MatDrawer; - - /** - * Constructor - */ - constructor() - { - } -} diff --git a/src/app/modules/admin/apps/chat/conversation/conversation.component.html b/src/app/modules/admin/apps/chat/conversation/conversation.component.html deleted file mode 100644 index 9c3fa082..00000000 --- a/src/app/modules/admin/apps/chat/conversation/conversation.component.html +++ /dev/null @@ -1,215 +0,0 @@ -
- - - - - - - - - - - - - - - - -
- - - - - - - -
-
- - Contact avatar - - -
- {{chat.contact.name.charAt(0)}} -
-
-
-
{{chat.contact.name}}
-
- - - - - - - - - -
- - -
-
- - - -
-
-
- {{message.createdAt | date: 'longDate'}} -
-
-
-
-
- -
- - -
- -
-
- -
-
-
- - -
- {{message.createdAt | date:'HH:mm'}} -
-
-
-
-
-
- - -
-
- - -
- - - -
- -
-
- -
- -
- -
- - - -
- -
Select a conversation or start a new chat
-
-
- - - - - - - - - - - - -
diff --git a/src/app/modules/admin/apps/chat/conversation/conversation.component.ts b/src/app/modules/admin/apps/chat/conversation/conversation.component.ts deleted file mode 100644 index 89ce4752..00000000 --- a/src/app/modules/admin/apps/chat/conversation/conversation.component.ts +++ /dev/null @@ -1,143 +0,0 @@ -import { ChangeDetectionStrategy, ChangeDetectorRef, Component, ElementRef, HostListener, NgZone, OnDestroy, OnInit, ViewChild, ViewEncapsulation } from '@angular/core'; -import { Subject } from 'rxjs'; -import { takeUntil } from 'rxjs/operators'; -import { Chat } from 'app/modules/admin/apps/chat/chat.types'; -import { ChatService } from 'app/modules/admin/apps/chat/chat.service'; - -@Component({ - selector : 'chat-conversation', - templateUrl : './conversation.component.html', - encapsulation : ViewEncapsulation.None, - changeDetection: ChangeDetectionStrategy.OnPush -}) -export class ConversationComponent implements OnInit, OnDestroy -{ - @ViewChild('messageInput') messageInput: ElementRef; - chat: Chat; - drawerOpened: boolean = false; - private _unsubscribeAll: Subject = new Subject(); - - /** - * Constructor - */ - constructor( - private _changeDetectorRef: ChangeDetectorRef, - private _chatService: ChatService, - private _ngZone: NgZone - ) - { - } - - // ----------------------------------------------------------------------------------------------------- - // @ Lifecycle hooks - // ----------------------------------------------------------------------------------------------------- - - /** - * On init - */ - ngOnInit(): void - { - // Chat - this._chatService.chat$ - .pipe(takeUntil(this._unsubscribeAll)) - .subscribe((chat: Chat) => { - this.chat = chat; - - // Mark for check - this._changeDetectorRef.markForCheck(); - }); - } - - /** - * On destroy - */ - ngOnDestroy(): void - { - // Unsubscribe from all subscriptions - this._unsubscribeAll.next(); - this._unsubscribeAll.complete(); - } - - // ----------------------------------------------------------------------------------------------------- - // @ Public methods - // ----------------------------------------------------------------------------------------------------- - - /** - * Open the contact info - */ - openContactInfo(): void - { - // Open the drawer - this.drawerOpened = true; - - // Mark for check - this._changeDetectorRef.markForCheck(); - } - - /** - * Reset the chat - */ - resetChat(): void - { - this._chatService.resetChat(); - - // Mark for check - this._changeDetectorRef.markForCheck(); - } - - /** - * Toggle mute notifications - */ - toggleMuteNotifications(): void - { - // Toggle the muted - this.chat.muted = !this.chat.muted; - - // Update the chat on the server - this._chatService.updateChat(this.chat.id, this.chat).subscribe(); - } - - /** - * Track by function for ngFor loops - * - * @param index - * @param item - */ - trackByFn(index: number, item: any): any - { - return item.id || index; - } - - // ----------------------------------------------------------------------------------------------------- - // @ Private methods - // ----------------------------------------------------------------------------------------------------- - - /** - * Resize on 'input' and 'ngModelChange' events - * - * @private - */ - @HostListener('input') - @HostListener('ngModelChange') - private _resizeMessageInput(): void - { - // This doesn't need to trigger Angular's change detection by itself - this._ngZone.runOutsideAngular(() => { - - setTimeout(() => { - - // Set the height to 'auto' so we can correctly read the scrollHeight - this.messageInput.nativeElement.style.height = 'auto'; - - // Detect the changes so the height is applied - this._changeDetectorRef.detectChanges(); - - // Get the scrollHeight and subtract the vertical padding - this.messageInput.nativeElement.style.height = `${this.messageInput.nativeElement.scrollHeight}px`; - - // Detect the changes one more time to apply the final height - this._changeDetectorRef.detectChanges(); - }); - }); - } -} diff --git a/src/app/modules/admin/apps/chat/new-chat/new-chat.component.html b/src/app/modules/admin/apps/chat/new-chat/new-chat.component.html deleted file mode 100644 index 13b5ef73..00000000 --- a/src/app/modules/admin/apps/chat/new-chat/new-chat.component.html +++ /dev/null @@ -1,51 +0,0 @@ -
- - -
- -
New chat
-
- -
- - - - -
- {{contact.name.charAt(0)}} -
-
- -
-
- - Contact avatar - - -
- {{contact.name.charAt(0)}} -
-
-
-
-
{{contact.name}}
-
{{contact.about}}
-
-
-
-
-
- - - -
There are no contacts!
-
- -
diff --git a/src/app/modules/admin/apps/chat/new-chat/new-chat.component.ts b/src/app/modules/admin/apps/chat/new-chat/new-chat.component.ts deleted file mode 100644 index 8492671f..00000000 --- a/src/app/modules/admin/apps/chat/new-chat/new-chat.component.ts +++ /dev/null @@ -1,68 +0,0 @@ -import { ChangeDetectionStrategy, Component, Input, OnDestroy, OnInit, ViewEncapsulation } from '@angular/core'; -import { MatDrawer } from '@angular/material/sidenav'; -import { Subject } from 'rxjs'; -import { takeUntil } from 'rxjs/operators'; -import { Contact } from 'app/modules/admin/apps/chat/chat.types'; -import { ChatService } from 'app/modules/admin/apps/chat/chat.service'; - -@Component({ - selector : 'chat-new-chat', - templateUrl : './new-chat.component.html', - encapsulation: ViewEncapsulation.None, - changeDetection: ChangeDetectionStrategy.OnPush -}) -export class NewChatComponent implements OnInit, OnDestroy -{ - @Input() drawer: MatDrawer; - contacts: Contact[] = []; - private _unsubscribeAll: Subject = new Subject(); - - /** - * Constructor - */ - constructor(private _chatService: ChatService) - { - } - - // ----------------------------------------------------------------------------------------------------- - // @ Lifecycle hooks - // ----------------------------------------------------------------------------------------------------- - - /** - * On init - */ - ngOnInit(): void - { - // Contacts - this._chatService.contacts$ - .pipe(takeUntil(this._unsubscribeAll)) - .subscribe((contacts: Contact[]) => { - this.contacts = contacts; - }); - } - - /** - * On destroy - */ - ngOnDestroy(): void - { - // Unsubscribe from all subscriptions - this._unsubscribeAll.next(); - this._unsubscribeAll.complete(); - } - - // ----------------------------------------------------------------------------------------------------- - // @ Public methods - // ----------------------------------------------------------------------------------------------------- - - /** - * Track by function for ngFor loops - * - * @param index - * @param item - */ - trackByFn(index: number, item: any): any - { - return item.id || index; - } -} diff --git a/src/app/modules/admin/apps/chat/profile/profile.component.html b/src/app/modules/admin/apps/chat/profile/profile.component.html deleted file mode 100644 index 017ce60c..00000000 --- a/src/app/modules/admin/apps/chat/profile/profile.component.html +++ /dev/null @@ -1,80 +0,0 @@ -
- - -
- -
Profile
-
- -
- -
- - - - - -
- {{profile.name.charAt(0)}} -
-
-
- - -
- - Name - - - - - Email - - - - - About - - - -
- - -
-
-
-
diff --git a/src/app/modules/admin/apps/chat/profile/profile.component.ts b/src/app/modules/admin/apps/chat/profile/profile.component.ts deleted file mode 100644 index 18cf4e29..00000000 --- a/src/app/modules/admin/apps/chat/profile/profile.component.ts +++ /dev/null @@ -1,53 +0,0 @@ -import { ChangeDetectionStrategy, Component, Input, OnDestroy, OnInit, ViewEncapsulation } from '@angular/core'; -import { MatDrawer } from '@angular/material/sidenav'; -import { Subject } from 'rxjs'; -import { takeUntil } from 'rxjs/operators'; -import { Profile } from 'app/modules/admin/apps/chat/chat.types'; -import { ChatService } from 'app/modules/admin/apps/chat/chat.service'; - -@Component({ - selector : 'chat-profile', - templateUrl : './profile.component.html', - encapsulation: ViewEncapsulation.None, - changeDetection: ChangeDetectionStrategy.OnPush -}) -export class ProfileComponent implements OnInit, OnDestroy -{ - @Input() drawer: MatDrawer; - profile: Profile; - private _unsubscribeAll: Subject = new Subject(); - - /** - * Constructor - */ - constructor(private _chatService: ChatService) - { - } - - // ----------------------------------------------------------------------------------------------------- - // @ Lifecycle hooks - // ----------------------------------------------------------------------------------------------------- - - /** - * On init - */ - ngOnInit(): void - { - // Profile - this._chatService.profile$ - .pipe(takeUntil(this._unsubscribeAll)) - .subscribe((profile: Profile) => { - this.profile = profile; - }); - } - - /** - * On destroy - */ - ngOnDestroy(): void - { - // Unsubscribe from all subscriptions - this._unsubscribeAll.next(); - this._unsubscribeAll.complete(); - } -}