This commit is contained in:
tiago.kayaya
2021-03-15 15:19:07 +01:00
parent 22c8951c0f
commit 6fba6c0d64
13 changed files with 148 additions and 33 deletions
+4
View File
@@ -11,7 +11,11 @@ const routes: Routes = [
{
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: 'chat',
+4 -1
View File
@@ -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 {}
+4 -2
View File
@@ -18,7 +18,7 @@
</div>
<div class="div-icon">
<ion-icon slot="end" (click)="newGroup()" src="assets/images/icons-chat-new-group.svg" ></ion-icon>
<ion-icon slot="end" (click)="selectContact()" src="assets/images/icons-chat-new-conversation.svg"></ion-icon>
<ion-icon slot="end" (click)="openContactsPage()" src="assets/images/icons-chat-new-conversation.svg"></ion-icon>
</div>
</div>
<ion-toolbar>
@@ -90,8 +90,10 @@
<!-- <ion-button (click)="openMessagesPage()">Messages</ion-button>
<ion-button (click)="openGroupMessagesPage('MduvQyrQBejb3xMrY')">Groups</ion-button>
<ion-button (click)="destroyComponent()">Destroy</ion-button> -->
<app-empty-chat class="d-flex height-100" *ngIf="showEmptyComponent"></app-empty-chat>
<app-messages class="d-flex height-100 flex-column" [roomId]="roomId" *ngIf="showMessages" #messagecontainer></app-messages>
<app-group-messages class="d-flex height-100 flex-column" [roomId]="roomId" *ngIf="showGroupMessages" #messagecontainer></app-group-messages>
<app-contacts *ngIf="showContacts" class="d-flex height-100"></app-contacts>
<app-group-messages *ngIf="showGroupMessages" class="d-flex height-100 flex-column" [roomId]="roomId" #messagecontainer></app-group-messages>
</div>
</div>
</ion-content>
+18 -1
View File
@@ -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();
}
@@ -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 {}
@@ -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 {}
@@ -0,0 +1,5 @@
<ion-content>
<div class="center height-100">
<p>Sem conversa selecionada</p>
</div>
</ion-content>
@@ -0,0 +1,5 @@
.center {
display: flex;
justify-content: center;
align-items: center;
}
@@ -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<EmptyChatPage>;
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();
});
});
@@ -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() {
}
}
@@ -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 {}
+3
View File
@@ -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 {}