diff --git a/src/app/pages/chat/chat.page.html b/src/app/pages/chat/chat.page.html index d05ced47c..445dc5297 100644 --- a/src/app/pages/chat/chat.page.html +++ b/src/app/pages/chat/chat.page.html @@ -92,7 +92,7 @@ Destroy --> - + diff --git a/src/app/shared/chat/group-messages/group-contacts/group-contacts.page.html b/src/app/shared/chat/group-messages/group-contacts/group-contacts.page.html index a2ae1f8b7..dc129dd35 100644 --- a/src/app/shared/chat/group-messages/group-contacts/group-contacts.page.html +++ b/src/app/shared/chat/group-messages/group-contacts/group-contacts.page.html @@ -26,9 +26,6 @@ - - -
Contactos selecção: diff --git a/src/app/shared/chat/group-messages/group-messages.page.html b/src/app/shared/chat/group-messages/group-messages.page.html index 262a9813f..c5971d016 100644 --- a/src/app/shared/chat/group-messages/group-messages.page.html +++ b/src/app/shared/chat/group-messages/group-messages.page.html @@ -6,7 +6,7 @@ {{room.name.split('-').join(' ')}}
- +
diff --git a/src/app/shared/chat/group-messages/group-messages.page.ts b/src/app/shared/chat/group-messages/group-messages.page.ts index 0f275b018..7e3823775 100644 --- a/src/app/shared/chat/group-messages/group-messages.page.ts +++ b/src/app/shared/chat/group-messages/group-messages.page.ts @@ -1,5 +1,5 @@ import { Component, OnChanges, OnInit, Input, SimpleChanges, Output, EventEmitter} from '@angular/core'; -import { ActionSheetController, MenuController, ModalController, PopoverController } from '@ionic/angular'; +import { ActionSheetController, AnimationController, MenuController, ModalController, PopoverController } from '@ionic/angular'; import { AuthService } from 'src/app/services/auth.service'; import { ChatService } from 'src/app/services/chat.service'; import { ChatOptionsPopoverPage } from 'src/app/shared/popover/chat-options-popover/chat-options-popover.page'; @@ -34,6 +34,7 @@ export class GroupMessagesPage implements OnInit, OnChanges { public popoverController: PopoverController, private chatService: ChatService, private authService: AuthService, + private animationController: AnimationController, ) { this.isGroupCreated = true; } @@ -137,6 +138,55 @@ export class GroupMessagesPage implements OnInit, OnChanges { }); this.message = ""; } + async openGroupMessagesOptions() { + + const enterAnimation = (baseEl: any) => { + const backdropAnimation = this.animationController.create() + .addElement(baseEl.querySelector('ion-backdrop')!) + .fromTo('opacity', '0.01', 'var(--backdrop-opacity)'); + + const wrapperAnimation = this.animationController.create() + .addElement(baseEl.querySelector('.modal-wrapper')!) + .keyframes([ + { offset: 0, opacity: '1', right: '-100%' }, + { offset: 1, opacity: '1', right: '0px' } + ]); + + return this.animationController.create() + .addElement(baseEl) + .easing('ease-out') + .duration(500) + .addAnimation([backdropAnimation, wrapperAnimation]); + } + + const leaveAnimation = (baseEl: any) => { + return enterAnimation(baseEl).direction('reverse'); + } + + + /* const popover = await this.popoverController.create({ + component: MessagesOptionsPage, + componentProps: { + roomId: this.dm._id, + }, + cssClass: 'messages-options', + event: ev, + translucent: true, + }); + return await popover.present(); */ + + const modal = await this.modalController.create({ + enterAnimation, + leaveAnimation, + component: ChatPopoverPage, + cssClass: 'model profile-modal search-submodal', + componentProps: { + roomId: this.roomId, + } + }); + return await modal.present(); + } + /* async openOptions(ev: any) { const popover = await this.popoverController.create({ diff --git a/src/app/shared/chat/messages/contacts/contacts.page.html b/src/app/shared/chat/messages/contacts/contacts.page.html index b2f8e9705..b8e86ee60 100644 --- a/src/app/shared/chat/messages/contacts/contacts.page.html +++ b/src/app/shared/chat/messages/contacts/contacts.page.html @@ -19,20 +19,22 @@ + +
- +
{{header}}
-
+

{{user.name}}

diff --git a/src/app/shared/chat/messages/contacts/contacts.page.scss b/src/app/shared/chat/messages/contacts/contacts.page.scss index 1eb104bdb..24392c458 100644 --- a/src/app/shared/chat/messages/contacts/contacts.page.scss +++ b/src/app/shared/chat/messages/contacts/contacts.page.scss @@ -4,7 +4,7 @@ --opacity: 1; .main-header{ - width: 100%; /* 400px */ + width: 100%; height: 100%; font-family: Roboto; border-top-left-radius: 25px; @@ -27,7 +27,6 @@ padding-left: 20px; } .title-content{ - width: 360px; margin: 0px auto; overflow: auto; padding: 0 !important; @@ -80,13 +79,13 @@ --background:transparent; } .main-content{ - width: 100%; - height: 100%; - font-family: Roboto; - margin: 0 auto; - background-color: #fff; - overflow:auto; - padding: 0 0 0 0; + width: 100%; + height: 100%; + font-family: Roboto; + margin: 0 auto; + background-color: #fff; + padding: 0 0 0 0; + overflow:auto; .item-divider{ background: #ebebeb; diff --git a/src/app/shared/chat/messages/contacts/contacts.page.ts b/src/app/shared/chat/messages/contacts/contacts.page.ts index ff86e8d5b..d52746222 100644 --- a/src/app/shared/chat/messages/contacts/contacts.page.ts +++ b/src/app/shared/chat/messages/contacts/contacts.page.ts @@ -1,5 +1,5 @@ import { HttpClient, HttpHeaders } from '@angular/common/http'; -import { Component, OnInit } from '@angular/core'; +import { Component, EventEmitter, OnInit, Output } from '@angular/core'; import { ModalController } from '@ionic/angular'; import { AuthService } from 'src/app/services/auth.service'; import { ChatService } from 'src/app/services/chat.service'; @@ -23,6 +23,8 @@ export class ContactsPage implements OnInit { room:any; dm:any; + @Output() openMessage:EventEmitter = new EventEmitter(); + constructor( private modalController: ModalController, private http: HttpClient, @@ -46,6 +48,22 @@ export class ContactsPage implements OnInit { this.textSearch = event.detail.value; } + openMessagesPage(username:string){ + if( window.innerWidth <= 1024){ + this.createRoom(username); + } + else{ + let body = { + username: username, + } + this.chatService.createRoom(body).subscribe(res => { + console.log(res); + this.room = res['room']; + this.openMessage.emit(this.room._id); + }); + } + } + loadUsers(){ this.options = { headers: this.headers, diff --git a/src/app/shared/chat/messages/messages.page.html b/src/app/shared/chat/messages/messages.page.html index 2936836e6..0dda497cf 100644 --- a/src/app/shared/chat/messages/messages.page.html +++ b/src/app/shared/chat/messages/messages.page.html @@ -7,7 +7,7 @@
- +
diff --git a/src/app/shared/chat/messages/messages.page.ts b/src/app/shared/chat/messages/messages.page.ts index 44f4e928c..ad7536359 100644 --- a/src/app/shared/chat/messages/messages.page.ts +++ b/src/app/shared/chat/messages/messages.page.ts @@ -1,10 +1,11 @@ import { AfterViewChecked, Component, ElementRef, Input, OnChanges, OnInit, SimpleChanges, ViewChild } from '@angular/core'; -import { ModalController, NavParams, PopoverController } from '@ionic/angular'; +import { AnimationController, ModalController, NavParams, PopoverController } from '@ionic/angular'; import { Status } from 'src/app/models/chat/status.model'; import { AuthService } from 'src/app/services/auth.service'; import { ChatService } from 'src/app/services/chat.service'; import { ChatOptionsPopoverPage } from 'src/app/shared/popover/chat-options-popover/chat-options-popover.page'; import { MessagesOptionsPage } from 'src/app/shared/popover/messages-options/messages-options.page'; +import { ProfileComponent } from '../../headers/header-no-search/profile/profile.component'; import { ContactsPage } from '../new-group/contacts/contacts.page'; @Component({ @@ -33,6 +34,7 @@ export class MessagesPage implements OnInit, AfterViewChecked, OnChanges { /* private navParams: NavParams, */ private chatService: ChatService, private authService: AuthService, + private animationController: AnimationController, ) { /* this.dm = this.navParams.get('dm'); */ } @@ -155,5 +157,56 @@ export class MessagesPage implements OnInit, AfterViewChecked, OnChanges { return await popover.present(); } + + + async _openMessagesOptions() { + + const enterAnimation = (baseEl: any) => { + const backdropAnimation = this.animationController.create() + .addElement(baseEl.querySelector('ion-backdrop')!) + .fromTo('opacity', '0.01', 'var(--backdrop-opacity)'); + + const wrapperAnimation = this.animationController.create() + .addElement(baseEl.querySelector('.modal-wrapper')!) + .keyframes([ + { offset: 0, opacity: '1', right: '-100%' }, + { offset: 1, opacity: '1', right: '0px' } + ]); + + return this.animationController.create() + .addElement(baseEl) + .easing('ease-out') + .duration(500) + .addAnimation([backdropAnimation, wrapperAnimation]); + } + + const leaveAnimation = (baseEl: any) => { + return enterAnimation(baseEl).direction('reverse'); + } + + + /* const popover = await this.popoverController.create({ + component: MessagesOptionsPage, + componentProps: { + roomId: this.dm._id, + }, + cssClass: 'messages-options', + event: ev, + translucent: true, + }); + return await popover.present(); */ + + const modal = await this.modalController.create({ + enterAnimation, + leaveAnimation, + component: MessagesOptionsPage, + cssClass: 'model profile-modal search-submodal', + componentProps: { + roomId: this.roomId, + } + }); + return await modal.present(); + } + } diff --git a/src/app/shared/popover/chat-popover/chat-popover.page.html b/src/app/shared/popover/chat-popover/chat-popover.page.html index 4f109ee1a..49130161a 100644 --- a/src/app/shared/popover/chat-popover/chat-popover.page.html +++ b/src/app/shared/popover/chat-popover/chat-popover.page.html @@ -1,5 +1,15 @@ - - + +
+ +
+
+ + +
+ + +
+
diff --git a/src/app/shared/popover/chat-popover/chat-popover.page.scss b/src/app/shared/popover/chat-popover/chat-popover.page.scss index 0171ad1d0..67e991974 100644 --- a/src/app/shared/popover/chat-popover/chat-popover.page.scss +++ b/src/app/shared/popover/chat-popover/chat-popover.page.scss @@ -1,15 +1,53 @@ -ion-row{ - padding: 10px 10px 5px 10px; +.container{ + --padding-top:20px !important; + --padding-bottom:20px !important; + --padding-start:20px !important; + --padding-end:20px !important; } -.border-top{ - padding-top: 5px !important; - border-top: 1px solid #ebebeb; +.arrow-right{ + display: none; + margin-bottom: 20px; + .arrow-right-icon{ + width: 37px; + float: right; + font-size: 35px; + overflow: hidden; + } +} +.buttons{ + display: flex; + flex-wrap: wrap; + justify-content: space-around; +} +.solid { + display: none; + width: 90%; + border-top: 1px solid #bbb; + margin: 0 auto !important; +} +@media only screen and (min-width: 1024px) { + .arrow-right{ + display: flex; + justify-content: flex-end; + } + .btn-cancel{ + //display: none; + width: 100% !important; + margin-bottom: 10px !important; + } + .btn-ok{ + width: 100% !important; + margin-bottom: 10px !important; +} + .btn-delete{ + width: 100% !important; + margin-bottom: 10px !important; + margin-top: 10px !important; + } + .solid{ + display: block; + } + .mobile-only{ + display: none !important; + } } -/* ion-col{ - border: 1px solid red; -} */ - -/* .btn-ok, .btn-cancel, .btn-delete{ - font-size: 13px; - padding:0 !important; -} */ diff --git a/src/app/shared/popover/chat-popover/chat-popover.page.ts b/src/app/shared/popover/chat-popover/chat-popover.page.ts index ebf338bd6..cae809bb3 100644 --- a/src/app/shared/popover/chat-popover/chat-popover.page.ts +++ b/src/app/shared/popover/chat-popover/chat-popover.page.ts @@ -25,7 +25,12 @@ export class ChatPopoverPage implements OnInit { } close(){ - this.popoverController.dismiss(); + if( window.innerWidth <= 1024){ + this.popoverController.dismiss(); + } + else{ + this.modalController.dismiss(); + } } //Top menu options diff --git a/src/app/shared/popover/messages-options/messages-options.page.html b/src/app/shared/popover/messages-options/messages-options.page.html index be9bcf347..9d8ac3b7d 100644 --- a/src/app/shared/popover/messages-options/messages-options.page.html +++ b/src/app/shared/popover/messages-options/messages-options.page.html @@ -1,10 +1,10 @@ - - - - - - - - - + +
+ +
+
+ +
+ +
diff --git a/src/app/shared/popover/messages-options/messages-options.page.scss b/src/app/shared/popover/messages-options/messages-options.page.scss index 63122bda8..03fcefe0d 100644 --- a/src/app/shared/popover/messages-options/messages-options.page.scss +++ b/src/app/shared/popover/messages-options/messages-options.page.scss @@ -1,3 +1,46 @@ -ion-row{ - padding: 10px 10px 5px 10px; +.container{ + --padding-top:20px !important; + --padding-bottom:20px !important; + --padding-start:20px !important; + --padding-end:20px !important; +} +.arrow-right{ + display: none; + margin-bottom: 20px; + .arrow-right-icon{ + width: 37px; + float: right; + font-size: 35px; + overflow: hidden; + } +} +.buttons{ + display: flex; + flex-wrap: wrap; + justify-content: space-around; +} +.solid { + display: none; + width: 90%; + border-top: 1px solid #bbb; + margin: 0 auto !important; + } +@media only screen and (min-width: 1024px) { + .arrow-right{ + display: flex; + justify-content: flex-end; + } + .btn-cancel{ + display: none; + width: 100% !important; + margin-bottom: 10px !important; + } + .btn-delete{ + width: 100% !important; + margin-bottom: 10px !important; + margin-top: 10px !important; + } + /* .solid{ + display: block; + } */ } \ No newline at end of file diff --git a/src/app/shared/popover/messages-options/messages-options.page.ts b/src/app/shared/popover/messages-options/messages-options.page.ts index 98ac52044..44262ee86 100644 --- a/src/app/shared/popover/messages-options/messages-options.page.ts +++ b/src/app/shared/popover/messages-options/messages-options.page.ts @@ -1,5 +1,5 @@ import { Component, OnInit } from '@angular/core'; -import { NavParams, PopoverController } from '@ionic/angular'; +import { ModalController, NavParams, PopoverController } from '@ionic/angular'; import { ChatService } from 'src/app/services/chat.service'; @Component({ @@ -13,6 +13,7 @@ export class MessagesOptionsPage implements OnInit { constructor( private popoverController: PopoverController, + private modalController: ModalController, private chatService: ChatService, private navParams: NavParams, ) @@ -24,7 +25,12 @@ export class MessagesOptionsPage implements OnInit { } close(){ - this.popoverController.dismiss(); + if( window.innerWidth <= 1024){ + this.popoverController.dismiss(); + } + else{ + this.modalController.dismiss(); + } } closeChatRoom(){ diff --git a/src/assets/icon/icons-arrow-arrow-left.svg b/src/assets/icon/icons-arrow-arrow-left.svg new file mode 100644 index 000000000..4c329dbd3 --- /dev/null +++ b/src/assets/icon/icons-arrow-arrow-left.svg @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/src/assets/images/icons-arrow-arrow-right.svg b/src/assets/images/icons-arrow-arrow-right.svg new file mode 100644 index 000000000..02f62df57 --- /dev/null +++ b/src/assets/images/icons-arrow-arrow-right.svg @@ -0,0 +1,9 @@ + + + + + + + + +