From 6fba6c0d64eb738bbd23e6888a97ae428c155881 Mon Sep 17 00:00:00 2001 From: "tiago.kayaya" Date: Mon, 15 Mar 2021 15:19:07 +0100 Subject: [PATCH] save --- src/app/app-routing.module.ts | 54 ++++++++++--------- src/app/app.module.ts | 2 +- src/app/pages/chat/chat.module.ts | 5 +- src/app/pages/chat/chat.page.html | 6 ++- src/app/pages/chat/chat.page.ts | 19 ++++++- .../empty-chat/empty-chat-routing.module.ts | 17 ++++++ .../chat/empty-chat/empty-chat.module.ts | 20 +++++++ .../chat/empty-chat/empty-chat.page.html | 5 ++ .../chat/empty-chat/empty-chat.page.scss | 5 ++ .../chat/empty-chat/empty-chat.page.spec.ts | 24 +++++++++ .../shared/chat/empty-chat/empty-chat.page.ts | 15 ++++++ .../chat/messages/contacts/contacts.module.ts | 6 +-- src/app/shared/shared.module.ts | 3 ++ 13 files changed, 148 insertions(+), 33 deletions(-) create mode 100644 src/app/shared/chat/empty-chat/empty-chat-routing.module.ts create mode 100644 src/app/shared/chat/empty-chat/empty-chat.module.ts create mode 100644 src/app/shared/chat/empty-chat/empty-chat.page.html create mode 100644 src/app/shared/chat/empty-chat/empty-chat.page.scss create mode 100644 src/app/shared/chat/empty-chat/empty-chat.page.spec.ts create mode 100644 src/app/shared/chat/empty-chat/empty-chat.page.ts diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index 8ea73ab47..8d9efe98a 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -1,27 +1,31 @@ -import { NgModule } from '@angular/core'; -import { PreloadAllModules, RouterModule, Routes } from '@angular/router'; -import { ChatPage } from './pages/chat/chat.page'; -import { MessagesPage } from './pages/chat/messages/messages.page'; - -const routes: Routes = [ - { - path: '', - loadChildren: () => import('./index/index.module').then(m => m.IndexPageModule) +import { NgModule } from '@angular/core'; +import { PreloadAllModules, RouterModule, Routes } from '@angular/router'; +import { ChatPage } from './pages/chat/chat.page'; +import { MessagesPage } from './pages/chat/messages/messages.page'; + +const routes: Routes = [ + { + path: '', + loadChildren: () => import('./index/index.module').then(m => m.IndexPageModule) + }, + { + path: '', + loadChildren: () => import('./home/home.module').then( m => m.HomePageModule) + }, { + path: 'empty-chat', + loadChildren: () => import('./shared/chat/empty-chat/empty-chat.module').then( m => m.EmptyChatPageModule) }, - { - path: '', - loadChildren: () => import('./home/home.module').then( m => m.HomePageModule) - }, - /* { - path: 'chat', - component: ChatPage - } */ -]; -@NgModule({ - imports: [ - RouterModule.forRoot(routes, { preloadingStrategy: PreloadAllModules }) - ], - exports: [RouterModule] -}) -export class AppRoutingModule {} + /* { + path: 'chat', + component: ChatPage + } */ + +]; +@NgModule({ + imports: [ + RouterModule.forRoot(routes, { preloadingStrategy: PreloadAllModules }) + ], + exports: [RouterModule] +}) +export class AppRoutingModule {} diff --git a/src/app/app.module.ts b/src/app/app.module.ts index adaccc9db..a88262399 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -45,7 +45,7 @@ import { MessagesPage } from './pages/chat/messages/messages.page'; IonicStorageModule.forRoot(), AppRoutingModule, PipesModule, - HttpClientModule, + HttpClientModule, ], providers: [ StatusBar, diff --git a/src/app/pages/chat/chat.module.ts b/src/app/pages/chat/chat.module.ts index 0d1929a26..066c25c5f 100644 --- a/src/app/pages/chat/chat.module.ts +++ b/src/app/pages/chat/chat.module.ts @@ -11,6 +11,8 @@ import { SharedModule } from 'src/app/shared/shared.module'; import { RouterModule } from '@angular/router'; import { GroupMessagesPage } from 'src/app/shared/chat/group-messages/group-messages.page'; import { MessagesPage } from 'src/app/shared/chat/messages/messages.page'; +import { EmptyChatPage } from 'src/app/shared/chat/empty-chat/empty-chat.page'; +import { ContactsPage } from 'src/app/shared/chat/messages/contacts/contacts.page'; @NgModule({ imports: [ @@ -24,9 +26,10 @@ import { MessagesPage } from 'src/app/shared/chat/messages/messages.page'; declarations: [ ChatPage, MessagesPage, + ContactsPage, GroupMessagesPage, ], schemas: [CUSTOM_ELEMENTS_SCHEMA], - entryComponents: [MessagesPage, GroupMessagesPage] + entryComponents: [MessagesPage,ContactsPage, GroupMessagesPage] }) export class ChatPageModule {} diff --git a/src/app/pages/chat/chat.page.html b/src/app/pages/chat/chat.page.html index 53f03b5e2..ca88f46e6 100644 --- a/src/app/pages/chat/chat.page.html +++ b/src/app/pages/chat/chat.page.html @@ -18,7 +18,7 @@
- +
@@ -90,8 +90,10 @@ + - + + diff --git a/src/app/pages/chat/chat.page.ts b/src/app/pages/chat/chat.page.ts index e31f52f53..a222e14b0 100644 --- a/src/app/pages/chat/chat.page.ts +++ b/src/app/pages/chat/chat.page.ts @@ -57,7 +57,9 @@ export class ChatPage implements OnInit { componentRef: any; roomId:any; + showEmptyComponent=true; showMessages=false; + showContacts=false; showGroupMessages=false; @Output() getRoomInfo; @@ -99,7 +101,9 @@ export class ChatPage implements OnInit { } closeAllDesktopComponents() { this.showMessages=false; + this.showContacts=false; this.showGroupMessages=false; + this.showEmptyComponent=false; } openMessagesPage(rid) { if( window.innerWidth <= 1024){ @@ -107,22 +111,35 @@ export class ChatPage implements OnInit { } else{ this.closeAllDesktopComponents(); + this.showEmptyComponent = false; this.roomId = rid; this.showMessages=true; } } + openContactsPage() { + console.log('OK'); + this.closeAllDesktopComponents(); + + if( window.innerWidth <= 1024){ + //this.selectContact(); + } + else{ + console.log('here'); + this.showContacts=true; + } + } openGroupMessagesPage(rid) { if( window.innerWidth <= 1024){ this.openGroupMessagesModal(rid); } else{ this.closeAllDesktopComponents(); + this.showEmptyComponent = false; this.roomId = rid; this.showGroupMessages=true; } } - onSegmentChange(){ this.load(); } diff --git a/src/app/shared/chat/empty-chat/empty-chat-routing.module.ts b/src/app/shared/chat/empty-chat/empty-chat-routing.module.ts new file mode 100644 index 000000000..f35c9faa0 --- /dev/null +++ b/src/app/shared/chat/empty-chat/empty-chat-routing.module.ts @@ -0,0 +1,17 @@ +import { NgModule } from '@angular/core'; +import { Routes, RouterModule } from '@angular/router'; + +import { EmptyChatPage } from './empty-chat.page'; + +const routes: Routes = [ + { + path: '', + component: EmptyChatPage + } +]; + +@NgModule({ + imports: [RouterModule.forChild(routes)], + exports: [RouterModule], +}) +export class EmptyChatPageRoutingModule {} diff --git a/src/app/shared/chat/empty-chat/empty-chat.module.ts b/src/app/shared/chat/empty-chat/empty-chat.module.ts new file mode 100644 index 000000000..bf6038f1c --- /dev/null +++ b/src/app/shared/chat/empty-chat/empty-chat.module.ts @@ -0,0 +1,20 @@ +import { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { FormsModule } from '@angular/forms'; + +import { IonicModule } from '@ionic/angular'; + +import { EmptyChatPageRoutingModule } from './empty-chat-routing.module'; + +import { EmptyChatPage } from './empty-chat.page'; + +@NgModule({ + imports: [ + CommonModule, + FormsModule, + IonicModule, + EmptyChatPageRoutingModule + ], + declarations: [EmptyChatPage] +}) +export class EmptyChatPageModule {} diff --git a/src/app/shared/chat/empty-chat/empty-chat.page.html b/src/app/shared/chat/empty-chat/empty-chat.page.html new file mode 100644 index 000000000..b5514095a --- /dev/null +++ b/src/app/shared/chat/empty-chat/empty-chat.page.html @@ -0,0 +1,5 @@ + +
+

Sem conversa selecionada

+
+
diff --git a/src/app/shared/chat/empty-chat/empty-chat.page.scss b/src/app/shared/chat/empty-chat/empty-chat.page.scss new file mode 100644 index 000000000..6483b8c01 --- /dev/null +++ b/src/app/shared/chat/empty-chat/empty-chat.page.scss @@ -0,0 +1,5 @@ +.center { + display: flex; + justify-content: center; + align-items: center; + } \ No newline at end of file diff --git a/src/app/shared/chat/empty-chat/empty-chat.page.spec.ts b/src/app/shared/chat/empty-chat/empty-chat.page.spec.ts new file mode 100644 index 000000000..361635c9e --- /dev/null +++ b/src/app/shared/chat/empty-chat/empty-chat.page.spec.ts @@ -0,0 +1,24 @@ +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; +import { IonicModule } from '@ionic/angular'; + +import { EmptyChatPage } from './empty-chat.page'; + +describe('EmptyChatPage', () => { + let component: EmptyChatPage; + let fixture: ComponentFixture; + + beforeEach(waitForAsync(() => { + TestBed.configureTestingModule({ + declarations: [ EmptyChatPage ], + imports: [IonicModule.forRoot()] + }).compileComponents(); + + fixture = TestBed.createComponent(EmptyChatPage); + component = fixture.componentInstance; + fixture.detectChanges(); + })); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/shared/chat/empty-chat/empty-chat.page.ts b/src/app/shared/chat/empty-chat/empty-chat.page.ts new file mode 100644 index 000000000..fff63b39d --- /dev/null +++ b/src/app/shared/chat/empty-chat/empty-chat.page.ts @@ -0,0 +1,15 @@ +import { Component, OnInit } from '@angular/core'; + +@Component({ + selector: 'app-empty-chat', + templateUrl: './empty-chat.page.html', + styleUrls: ['./empty-chat.page.scss'], +}) +export class EmptyChatPage implements OnInit { + + constructor() { } + + ngOnInit() { + } + +} diff --git a/src/app/shared/chat/messages/contacts/contacts.module.ts b/src/app/shared/chat/messages/contacts/contacts.module.ts index 8284984be..b90d8af4e 100644 --- a/src/app/shared/chat/messages/contacts/contacts.module.ts +++ b/src/app/shared/chat/messages/contacts/contacts.module.ts @@ -8,7 +8,7 @@ import { ContactsPageRoutingModule } from './contacts-routing.module'; import { ContactsPage } from './contacts.page'; import { SharedModule } from 'src/app/shared/shared.module'; -import { PipesModule } from 'src/app/pipes/pipes.module'; +import { FilterPipe } from 'src/app/pipes/filter.pipe'; @NgModule({ imports: [ @@ -16,9 +16,9 @@ import { PipesModule } from 'src/app/pipes/pipes.module'; FormsModule, IonicModule, SharedModule, - PipesModule, ContactsPageRoutingModule ], - declarations: [ContactsPage] + exports: [FilterPipe], + declarations: [ContactsPage, FilterPipe] }) export class ContactsPageModule {} diff --git a/src/app/shared/shared.module.ts b/src/app/shared/shared.module.ts index 7b1be4f52..7924c965b 100644 --- a/src/app/shared/shared.module.ts +++ b/src/app/shared/shared.module.ts @@ -8,6 +8,7 @@ import { BtnSeguintePage } from './btn-seguinte/btn-seguinte.page'; import { BtnModalDismissPage } from './btn-modal-dismiss/btn-modal-dismiss.page'; import { ChatPopoverPage } from './popover/chat-popover/chat-popover.page'; import { HeaderNoSearchPage } from './headers/header-no-search/header-no-search.page'; +import { EmptyChatPage } from './chat/empty-chat/empty-chat.page'; @NgModule({ imports: [ @@ -21,6 +22,7 @@ import { HeaderNoSearchPage } from './headers/header-no-search/header-no-search. HeaderNoSearchPage, BtnSeguintePage, BtnModalDismissPage, + EmptyChatPage, ], entryComponents:[], declarations: [ @@ -29,6 +31,7 @@ import { HeaderNoSearchPage } from './headers/header-no-search/header-no-search. HeaderNoSearchPage, BtnSeguintePage, BtnModalDismissPage, + EmptyChatPage, ] }) export class SharedModule {} \ No newline at end of file