From 437209bf7f82df369cf91b2a1292b78489961737 Mon Sep 17 00:00:00 2001 From: leejh Date: Mon, 4 Nov 2019 17:52:47 +0900 Subject: [PATCH] =?UTF-8?q?FAB=20=EA=B8=B0=EB=8A=A5=20=EC=B6=94=EA=B0=80?= =?UTF-8?q?=20::=20=EB=8C=80=20=EB=A9=94=EB=89=B4=20=EC=84=A0=ED=83=9D?= =?UTF-8?q?=EC=97=90=20=EB=94=B0=EB=A5=B8=20=EC=B2=98=EB=A6=AC.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/left-side.component.html | 21 ++- .../components/left-side.component.ts | 121 +++++++++++++++--- .../left-sidenav/group.component.ts | 49 ++----- .../left-sidenav/organization.component.ts | 1 - .../lib/components/list-item.component.html | 9 +- .../src/lib/ucap-ui-room.module.ts | 3 +- 6 files changed, 143 insertions(+), 61 deletions(-) diff --git a/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-side.component.html b/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-side.component.html index 3784e5ce..89087066 100644 --- a/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-side.component.html +++ b/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-side.component.html @@ -6,14 +6,22 @@ --> - - + + group - + - + - + device_hub @@ -37,7 +45,7 @@ class="organization-side" > - + phone @@ -45,6 +53,7 @@ diff --git a/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-side.component.ts b/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-side.component.ts index f26c4022..9b1c15ce 100644 --- a/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-side.component.ts +++ b/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-side.component.ts @@ -12,13 +12,22 @@ import { Store, select } from '@ngrx/store'; import * as AppStore from '@app/store'; import * as ChatStore from '@app/store/messenger/chat'; +import * as SyncStore from '@app/store/messenger/sync'; import { UserInfo } from '@ucap-webmessenger/protocol-sync'; import { UserInfoSS, UserInfoF, UserInfoDN } from '@ucap-webmessenger/protocol-query'; -import { BuiltinType } from '@angular/compiler'; +import { MatTabChangeEvent, MatTabGroup } from '@angular/material'; + +export enum MainMenu { + Group = 'GROUP', + Chat = 'CAHT', + Organization = 'ORGANIZATION', + Call = 'CALL', + Conversation = 'CONVERSATION' +} @Component({ selector: 'app-layout-messenger-left-side', @@ -33,8 +42,11 @@ export class LeftSideComponent implements OnInit { selectedUserList: (UserInfo | UserInfoSS | UserInfoF | UserInfoDN)[] = []; /** FAB */ + fabButtonShow = true; fabButtons: { icon: string; tooltip?: string; divisionType?: string }[]; + MainMenu = MainMenu; + constructor( private store: Store, private dialogService: DialogService, @@ -45,18 +57,8 @@ export class LeftSideComponent implements OnInit { this.badgeChatUnReadCount$ = this.store.pipe( select(AppStore.MessengerSelector.SyncSelector.selectChatUnreadCount) ); - this.fabButtons = [ - { - icon: 'timer', - tooltip: 'New Timer Chat', - divisionType: 'NEW_TIMER_CHAT' - }, - { - icon: 'chat', - tooltip: 'New Chat', - divisionType: 'NEW_CHAT' - } - ]; + + this.setFabInitial(MainMenu.Group); } async onClickNewChat(type: string = 'NORMAL') { @@ -88,6 +90,89 @@ export class LeftSideComponent implements OnInit { } } + async onClickNewGroupAndMember() { + const result = await this.dialogService.open< + CreateChatDialogComponent, + CreateChatDialogData, + CreateChatDialogResult + >(CreateChatDialogComponent, { + width: '600px', + data: { + type: UserSelectDialogType.NewGroup, + title: 'New Group' + } + }); + + if (!!result && !!result.choice && result.choice) { + if ( + !!result.selectedUserList && + result.selectedUserList.length > 0 && + result.groupName.trim().length > 0 + ) { + const userSeqs: number[] = []; + result.selectedUserList.map(user => userSeqs.push(user.seq)); + + this.store.dispatch( + SyncStore.createGroupAndBuddy({ + groupName: result.groupName, + trgtUserSeq: userSeqs + }) + ); + } + } + } + + onSelectedTabChange(event: MatTabChangeEvent) { + this.setFabInitial(event.tab.ariaLabel); + } + setFabInitial(type: string) { + switch (type) { + case MainMenu.Group: + { + this.fabButtonShow = true; + this.fabButtons = [ + { + icon: 'add', + tooltip: 'New Group Add', + divisionType: 'GROUP_NEW_ADD' + } + ]; + } + break; + case MainMenu.Chat: + { + this.fabButtonShow = true; + this.fabButtons = [ + { + icon: 'timer', + tooltip: 'New Timer Chat', + divisionType: 'CHAT_NEW_TIMER_ADD' + }, + { + icon: 'chat', + tooltip: 'New Chat', + divisionType: 'CAHT_NEW_ADD' + } + ]; + } + break; + // case MainMenu.Organization: + // { + + // } + // break; + // case MainMenu.Call: + // { + + // } + // break; + + default: { + this.fabButtonShow = false; + } + } + } + onCheckAllUser(params: { isChecked: boolean; userInfos: (UserInfo | UserInfoSS | UserInfoF | UserInfoDN)[]; @@ -137,12 +222,18 @@ export class LeftSideComponent implements OnInit { }; switch (btn.divisionType) { - case 'NEW_CHAT': + case 'GROUP_NEW_ADD': + { + this.onClickNewGroupAndMember(); + } + break; + + case 'CAHT_NEW_ADD': { this.onClickNewChat('NORMAL'); } break; - case 'NEW_TIMER_CHAT': + case 'CHAT_NEW_TIMER_ADD': { this.onClickNewChat('TIMER'); } diff --git a/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-sidenav/group.component.ts b/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-sidenav/group.component.ts index 1fd8aee6..6f316a82 100644 --- a/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-sidenav/group.component.ts +++ b/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-sidenav/group.component.ts @@ -1,7 +1,12 @@ -import { StatusProtocolService } from './../../../../../../../ucap-webmessenger-protocol-status/src/lib/services/status-protocol.service'; -import { UserSelectDialogType } from './../../../../types/userselect.dialog.type'; import { MatMenuTrigger } from '@angular/material'; -import { Component, OnInit, ViewChild, OnDestroy } from '@angular/core'; +import { + Component, + OnInit, + ViewChild, + OnDestroy, + EventEmitter, + Output +} from '@angular/core'; import { Observable, combineLatest, Subscription, of } from 'rxjs'; import { map, tap, catchError, exhaustMap } from 'rxjs/operators'; @@ -9,7 +14,6 @@ import { Store, select } from '@ngrx/store'; import * as AppStore from '@app/store'; import * as ChatStore from '@app/store/messenger/chat'; -import * as QueryStore from '@app/store/messenger/query'; import * as SyncStore from '@app/store/messenger/sync'; import * as StatusStore from '@app/store/messenger/status'; @@ -17,12 +21,13 @@ import { NGXLogger } from 'ngx-logger'; import { Company } from '@ucap-webmessenger/api-external'; import { SessionStorageService } from '@ucap-webmessenger/web-storage'; import { VersionInfo2Response } from '@ucap-webmessenger/api-public'; -import { LoginInfo, KEY_LOGIN_INFO } from '@app/types'; +import { LoginInfo, KEY_LOGIN_INFO, UserSelectDialogType } from '@app/types'; import { KEY_VER_INFO } from '@app/types/ver-info.type'; import { ExpansionPanelComponent as GroupExpansionPanelComponent } from '@ucap-webmessenger/ui-group'; import { LoginResponse } from '@ucap-webmessenger/protocol-authentication'; import { UserInfo, GroupDetailData } from '@ucap-webmessenger/protocol-sync'; +import { StatusProtocolService } from '@ucap-webmessenger/protocol-status'; import { DeptSearchType, UserInfoSS, @@ -59,6 +64,9 @@ import { animations: ucapAnimations }) export class GroupComponent implements OnInit, OnDestroy { + @Output() + newGroupAndMember = new EventEmitter(); + @ViewChild('groupExpansionPanel', { static: true }) groupExpansionPanel: GroupExpansionPanelComponent; @@ -164,35 +172,7 @@ export class GroupComponent implements OnInit, OnDestroy { switch (menuType) { case 'GROUP_NEW': { - const result = await this.dialogService.open< - CreateChatDialogComponent, - CreateChatDialogData, - CreateChatDialogResult - >(CreateChatDialogComponent, { - width: '600px', - data: { - type: UserSelectDialogType.NewGroup, - title: 'New Group' - } - }); - - if (!!result && !!result.choice && result.choice) { - if ( - !!result.selectedUserList && - result.selectedUserList.length > 0 && - result.groupName.trim().length > 0 - ) { - const userSeqs: number[] = []; - result.selectedUserList.map(user => userSeqs.push(user.seq)); - - this.store.dispatch( - SyncStore.createGroupAndBuddy({ - groupName: result.groupName, - trgtUserSeq: userSeqs - }) - ); - } - } + this.newGroupAndMember.emit(); } break; case 'GROUP_EXPAND_MORE': @@ -361,7 +341,6 @@ export class GroupComponent implements OnInit, OnDestroy { EditGroupDialogData, EditGroupDialogResult >(EditGroupDialogComponent, { - data: { title: 'Group Name Edit', group diff --git a/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-sidenav/organization.component.ts b/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-sidenav/organization.component.ts index bbd7ddcb..e11ac45e 100644 --- a/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-sidenav/organization.component.ts +++ b/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-sidenav/organization.component.ts @@ -250,7 +250,6 @@ export class OrganizationComponent implements OnInit, OnDestroy { SelectGroupDialogResult >(SelectGroupDialogComponent, { width: '600px', - height: '500px', data: { title: 'Group Select' } diff --git a/projects/ucap-webmessenger-ui-room/src/lib/components/list-item.component.html b/projects/ucap-webmessenger-ui-room/src/lib/components/list-item.component.html index 65f730fd..e15413dd 100644 --- a/projects/ucap-webmessenger-ui-room/src/lib/components/list-item.component.html +++ b/projects/ucap-webmessenger-ui-room/src/lib/components/list-item.component.html @@ -1,4 +1,4 @@ -
+
@@ -10,7 +10,7 @@ [default]="defaultPath" /> - timer + timer