diff --git a/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/intro.component.html b/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/intro.component.html index bf350c3a..b6dd54fb 100644 --- a/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/intro.component.html +++ b/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/intro.component.html @@ -10,7 +10,7 @@ {{ getTitle() }} diff --git a/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-sidenav/message.component.html b/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-sidenav/message.component.html index 4f968eb7..7d1cece4 100644 --- a/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-sidenav/message.component.html +++ b/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-sidenav/message.component.html @@ -48,9 +48,12 @@ > - {{ 'message.messageTypeReceiving' | translate }} + {{ 'message.type.messageTypeReceiving' | translate }} - + +
+ {{ 'common.noResult' | translate }} +
- {{ 'message.messageTypeOutgoing' | translate }} + {{ 'message.type.messageTypeOutgoing' | translate }} - + +
+ {{ 'common.noResult' | translate }} +
- {{ 'message.messageTypeReservation' | translate }} + {{ 'message.type.messageTypeReservation' | translate }} - + +
+ {{ 'common.noResult' | translate }} +
@@ -93,21 +132,16 @@
- {{ - 'message.messageTypeAll' | translate - }} - {{ - 'message.messageTypeReceiving' | translate - }} - {{ - 'message.messageTypeOutgoing' | translate - }} - {{ - 'message.messageTypeReservation' | translate - }} + + {{ messageType.displayName }} +
- + +
+ {{ 'common.noSearchResult' | translate }} +
diff --git a/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-sidenav/message.component.scss b/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-sidenav/message.component.scss index b0b1ee0c..eb2aefba 100644 --- a/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-sidenav/message.component.scss +++ b/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-sidenav/message.component.scss @@ -30,5 +30,10 @@ position: relative; height: 100%; } + + .no-search-result { + padding-top: 10px; + padding-left: 10px; + } } } diff --git a/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-sidenav/message.component.ts b/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-sidenav/message.component.ts index 82848c10..615445f4 100644 --- a/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-sidenav/message.component.ts +++ b/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-sidenav/message.component.ts @@ -8,9 +8,8 @@ import { Input, AfterViewChecked } from '@angular/core'; -import { Observable, Subscription } from 'rxjs'; +import { Observable, Subscription, merge } from 'rxjs'; import { Store, select } from '@ngrx/store'; -import { tap } from 'rxjs/operators'; import { NGXLogger } from 'ngx-logger'; import { VersionInfo2Response } from '@ucap-webmessenger/api-public'; @@ -53,6 +52,11 @@ import * as AppStore from '@app/store'; import * as MessageStore from '@app/store/messenger/message'; import { TranslateService } from '@ngx-translate/core'; +export interface MessageTypeData { + displayName: string; + name: string; +} + @Component({ selector: 'app-layout-chat-left-sidenav-message', templateUrl: './message.component.html', @@ -95,6 +99,9 @@ export class MessageBoxComponent isSearch = false; + messageTypeList: MessageTypeData[] = []; + langChangeSubscription: Subscription; + constructor( private store: Store, private formBuilder: FormBuilder, @@ -217,6 +224,15 @@ export class MessageBoxComponent if (!!this.tabs) { this.tabs.realignInkBar(); } + + this.setMessageTypeData(); + this.langChangeSubscription = merge( + this.translateService.onLangChange, + this.translateService.onDefaultLangChange, + this.translateService.onTranslationChange + ).subscribe(() => { + this.setMessageTypeData(); + }); } ngAfterViewChecked(): void { @@ -230,6 +246,9 @@ export class MessageBoxComponent if (!!this.messageDetailInfo) { this.messageDetailInfo.unsubscribe(); } + if (!!this.langChangeSubscription) { + this.langChangeSubscription.unsubscribe(); + } } onSelectedIndexTab(value: number) { @@ -275,6 +294,10 @@ export class MessageBoxComponent event.preventDefault(); event.stopPropagation(); + if (!search || search.trim().length === 0) { + return; + } + this.getSearchMessage( MessageType.All, MessageSearchType.Name, @@ -343,4 +366,32 @@ export class MessageBoxComponent }) ); } + + private setMessageTypeData() { + const messageTypeData = this.translateService.instant('message.type'); + + const messageTypeList: MessageTypeData[] = []; + for (const key in messageTypeData) { + if (messageTypeData.hasOwnProperty(key)) { + let name = 'A'; + switch (key) { + case 'messageTypeAll': + name = MessageType.All; + break; + case 'messageTypeReceiving': + name = MessageType.Receive; + break; + case 'messageTypeOutgoing': + name = MessageType.Send; + break; + case 'messageTypeReservation': + name = MessageType.Reservation; + break; + } + messageTypeList.push({ displayName: messageTypeData[key], name }); + } + } + + this.messageTypeList = messageTypeList; + } } diff --git a/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/messages.component.ts b/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/messages.component.ts index 113442f1..a144f052 100644 --- a/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/messages.component.ts +++ b/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/messages.component.ts @@ -265,6 +265,20 @@ export class MessagesComponent implements OnInit, OnDestroy, AfterViewInit { .subscribe(roomInfo => { this.clearView(); this.roomInfoSubject.next(roomInfo); + + if (!!this.roomInfoSubject.value && !!this.interval) { + clearInterval(this.interval); + this.interval = undefined; + } + + if ( + !!this.roomInfoSubject.value && + !!this.roomInfoSubject.value.isTimeRoom + ) { + this.interval = setInterval(() => { + this.store.dispatch(EventStore.infoIntervalClear({})); + }, 1000); + } }); this.userInfoListSubscription = this.store @@ -393,15 +407,6 @@ export class MessagesComponent implements OnInit, OnDestroy, AfterViewInit { } } }); - - if ( - !!this.roomInfoSubject.value && - !!this.roomInfoSubject.value.isTimeRoom - ) { - this.interval = setInterval(() => { - this.store.dispatch(EventStore.infoIntervalClear({})); - }, 1000); - } } ngOnDestroy(): void { diff --git a/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/message/message-detail.dialog.component.html b/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/message/message-detail.dialog.component.html index 10bc0467..65cb4915 100644 --- a/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/message/message-detail.dialog.component.html +++ b/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/message/message-detail.dialog.component.html @@ -3,13 +3,13 @@ {{ - 'message.messageTypeReceiving' | translate + 'message.type.messageTypeReceiving' | translate }} {{ - 'message.messageTypeOutgoing' | translate + 'message.type.messageTypeOutgoing' | translate }} {{ - 'message.messageTypeReservation' | translate + 'message.type.messageTypeReservation' | translate }} diff --git a/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/search/integrated-search.dialog.component.html b/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/search/integrated-search.dialog.component.html index d73db39d..b3c51179 100644 --- a/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/search/integrated-search.dialog.component.html +++ b/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/search/integrated-search.dialog.component.html @@ -20,7 +20,7 @@ [totalCount]="totalCount" [pageCurrent]="pageCurrent" [pageListCount]="pageListCount" - (search)="onSearch($event)" + (search)="onReSearch($event)" (changePage)="onChangePage($event)" (openProfile)="onClickOpenProfile($event)" > diff --git a/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/search/integrated-search.dialog.component.ts b/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/search/integrated-search.dialog.component.ts index d96425c2..0368cc04 100644 --- a/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/search/integrated-search.dialog.component.ts +++ b/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/search/integrated-search.dialog.component.ts @@ -92,6 +92,12 @@ export class IntegratedSearchDialogComponent implements OnInit, OnDestroy { ); } + onReSearch(searchWord: string) { + this.pageCurrent = 1; + + this.onSearch(searchWord); + } + onSearch(searchWord: string) { this.currentSearchWord = this.data.keyword; diff --git a/projects/ucap-webmessenger-app/src/app/layouts/native/components/top-bar.component.html b/projects/ucap-webmessenger-app/src/app/layouts/native/components/top-bar.component.html index 66e5729a..e59e270a 100644 --- a/projects/ucap-webmessenger-app/src/app/layouts/native/components/top-bar.component.html +++ b/projects/ucap-webmessenger-app/src/app/layouts/native/components/top-bar.component.html @@ -10,7 +10,7 @@