From a4c572f5e76dd1ad27dfa7c844233c8c15bd8a8a Mon Sep 17 00:00:00 2001 From: Richard Park Date: Wed, 16 Oct 2019 15:06:22 +0900 Subject: [PATCH 1/4] loading type is changed --- .../components/left-side.component.html | 16 ++++----------- .../left-sidenav/organization.component.html | 20 ++++++++++++++----- 2 files changed, 19 insertions(+), 17 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 6960b402..e91764a3 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 @@ -4,33 +4,25 @@ group - - - + chat - - - + device_hub - - - + phone - - - + diff --git a/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-sidenav/organization.component.html b/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-sidenav/organization.component.html index 995c7140..e1c70420 100644 --- a/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-sidenav/organization.component.html +++ b/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-sidenav/organization.component.html @@ -1,15 +1,25 @@ -
+
- +
(선택된부서명)
- +
From 2d6d4adb352d2c8335027107da081c7ba68803da Mon Sep 17 00:00:00 2001 From: Richard Park Date: Wed, 16 Oct 2019 15:36:18 +0900 Subject: [PATCH 2/4] Dialogs are added --- .../left-sidenav/group.component.html | 2 +- .../left-sidenav/group.component.ts | 74 ++++++++++++++++++- .../create-group.dialog.component.html | 2 +- .../delete-group.dialog.component.html | 18 +++++ .../delete-group.dialog.component.scss | 0 .../delete-group.dialog.component.spec.ts | 24 ++++++ .../dialogs/delete-group.dialog.component.ts | 34 +++++++++ .../edit-group-member.dialog.component.html | 18 +++++ .../edit-group-member.dialog.component.scss | 0 ...edit-group-member.dialog.component.spec.ts | 24 ++++++ .../edit-group-member.dialog.component.ts | 34 +++++++++ .../dialogs/edit-group.dialog.component.html | 18 +++++ .../dialogs/edit-group.dialog.component.scss | 0 .../edit-group.dialog.component.spec.ts | 24 ++++++ .../dialogs/edit-group.dialog.component.ts | 31 ++++++++ .../app/layouts/messenger/dialogs/index.ts | 10 ++- 16 files changed, 308 insertions(+), 5 deletions(-) create mode 100644 projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/delete-group.dialog.component.html create mode 100644 projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/delete-group.dialog.component.scss create mode 100644 projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/delete-group.dialog.component.spec.ts create mode 100644 projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/delete-group.dialog.component.ts create mode 100644 projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/edit-group-member.dialog.component.html create mode 100644 projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/edit-group-member.dialog.component.scss create mode 100644 projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/edit-group-member.dialog.component.spec.ts create mode 100644 projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/edit-group-member.dialog.component.ts create mode 100644 projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/edit-group.dialog.component.html create mode 100644 projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/edit-group.dialog.component.scss create mode 100644 projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/edit-group.dialog.component.spec.ts create mode 100644 projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/edit-group.dialog.component.ts diff --git a/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-sidenav/group.component.html b/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-sidenav/group.component.html index 1804ecb4..1f727051 100644 --- a/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-sidenav/group.component.html +++ b/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-sidenav/group.component.html @@ -142,7 +142,7 @@ > 그룹 멤버 변경 - 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 3434ba34..7b0478ae 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 @@ -31,6 +31,22 @@ import { import { MatMenuTrigger } from '@angular/material'; import { VersionInfo2Response } from '@ucap-webmessenger/api-public'; import { KEY_VER_INFO } from '@app/types/ver-info.type'; +import { + DeleteGroupDialogComponent, + DeleteGroupDialogData, + DeleteGroupDialogResult +} from '@app/layouts/messenger/dialogs/delete-group.dialog.component'; + +import { + EditGroupDialogComponent, + EditGroupDialogData, + EditGroupDialogResult +} from '@app/layouts/messenger/dialogs/edit-group.dialog.component'; +import { + EditGroupMemberDialogComponent, + EditGroupMemberDialogData, + EditGroupMemberDialogResult +} from '@app/layouts/messenger/dialogs/edit-group-member.dialog.component'; @Component({ selector: 'app-layout-chat-left-sidenav-group', @@ -229,7 +245,7 @@ export class GroupComponent implements OnInit, OnDestroy { this.profileContextMenuTrigger.openMenu(); } - onClickGroupContextMenu(menuType: string, group: GroupDetailData) { + async onClickGroupContextMenu(menuType: string, group: GroupDetailData) { this.logger.debug( 'onClickGroupContextMenu', 'menuType', @@ -246,10 +262,64 @@ export class GroupComponent implements OnInit, OnDestroy { case 'SEND_NOTE': break; case 'RENAME': + { + const result = await this.dialogService.open< + EditGroupDialogComponent, + EditGroupDialogData, + EditGroupDialogResult + >(EditGroupDialogComponent, { + width: '220px', + data: { + title: 'Logout', + message: 'Logout ?' + } + }); + } break; case 'EDIT_MEMBER': + { + const result = await this.dialogService.open< + EditGroupMemberDialogComponent, + EditGroupMemberDialogData, + EditGroupMemberDialogResult + >(EditGroupMemberDialogComponent, { + width: '220px', + data: { + title: 'Logout', + message: 'Logout ?' + } + }); + } break; - case 'REMOVE': + case 'DELETE': + { + const result = await this.dialogService.open< + DeleteGroupDialogComponent, + DeleteGroupDialogData, + DeleteGroupDialogResult + >(DeleteGroupDialogComponent, { + width: '220px', + data: { + title: 'Logout', + message: 'Logout ?' + } + }); + } + break; + case 'EDIT_MEMBER': + { + const result = await this.dialogService.open< + EditGroupMemberDialogComponent, + EditGroupMemberDialogData, + EditGroupMemberDialogResult + >(EditGroupMemberDialogComponent, { + width: '220px', + data: { + title: 'Logout', + message: 'Logout ?' + } + }); + } break; default: break; diff --git a/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/create-group.dialog.component.html b/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/create-group.dialog.component.html index 09d25dfe..2229c733 100644 --- a/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/create-group.dialog.component.html +++ b/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/create-group.dialog.component.html @@ -1,5 +1,5 @@ - + 새 그룹 추가 diff --git a/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/delete-group.dialog.component.html b/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/delete-group.dialog.component.html new file mode 100644 index 00000000..a6ad0056 --- /dev/null +++ b/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/delete-group.dialog.component.html @@ -0,0 +1,18 @@ + + + 그룹 삭제 + + + + + + + diff --git a/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/delete-group.dialog.component.scss b/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/delete-group.dialog.component.scss new file mode 100644 index 00000000..e69de29b diff --git a/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/delete-group.dialog.component.spec.ts b/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/delete-group.dialog.component.spec.ts new file mode 100644 index 00000000..e279601d --- /dev/null +++ b/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/delete-group.dialog.component.spec.ts @@ -0,0 +1,24 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { EditGroupDialogComponent } from './edit-group.dialog.component'; + +describe('app::layouts::messenger::EditGroupDialogComponent', () => { + let component: EditGroupDialogComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [EditGroupDialogComponent] + }).compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(EditGroupDialogComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/delete-group.dialog.component.ts b/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/delete-group.dialog.component.ts new file mode 100644 index 00000000..db8d4026 --- /dev/null +++ b/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/delete-group.dialog.component.ts @@ -0,0 +1,34 @@ +import { Component, OnInit, Inject } from '@angular/core'; +import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material'; + +export interface DeleteGroupDialogData { + title: string; + message?: string; +} + +export interface DeleteGroupDialogResult { + choice: boolean; +} + +@Component({ + selector: 'app-layout-messenger-delete-group', + templateUrl: './delete-group.dialog.component.html', + styleUrls: ['./delete-group.dialog.component.scss'] +}) +export class DeleteGroupDialogComponent implements OnInit { + constructor( + public dialogRef: MatDialogRef< + DeleteGroupDialogData, + DeleteGroupDialogResult + >, + @Inject(MAT_DIALOG_DATA) public data: DeleteGroupDialogData + ) {} + + ngOnInit(): void {} + + onClickChoice(choice: boolean): void { + this.dialogRef.close({ + choice + }); + } +} diff --git a/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/edit-group-member.dialog.component.html b/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/edit-group-member.dialog.component.html new file mode 100644 index 00000000..f0f997bf --- /dev/null +++ b/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/edit-group-member.dialog.component.html @@ -0,0 +1,18 @@ + + + 그룹 맴버 수정 + + + + + + + diff --git a/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/edit-group-member.dialog.component.scss b/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/edit-group-member.dialog.component.scss new file mode 100644 index 00000000..e69de29b diff --git a/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/edit-group-member.dialog.component.spec.ts b/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/edit-group-member.dialog.component.spec.ts new file mode 100644 index 00000000..24f3444d --- /dev/null +++ b/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/edit-group-member.dialog.component.spec.ts @@ -0,0 +1,24 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { EditGroupMemberDialogComponent } from './edit-group-member.dialog.component'; + +describe('app::layouts::messenger::EditGroupMemberDialogComponent', () => { + let component: EditGroupMemberDialogComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [EditGroupMemberDialogComponent] + }).compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(EditGroupMemberDialogComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/edit-group-member.dialog.component.ts b/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/edit-group-member.dialog.component.ts new file mode 100644 index 00000000..2656c44f --- /dev/null +++ b/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/edit-group-member.dialog.component.ts @@ -0,0 +1,34 @@ +import { Component, OnInit, Inject } from '@angular/core'; +import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material'; + +export interface EditGroupMemberDialogData { + title: string; + message?: string; +} + +export interface EditGroupMemberDialogResult { + choice: boolean; +} + +@Component({ + selector: 'app-layout-messenger-edit-group-member', + templateUrl: './edit-group-member.dialog.component.html', + styleUrls: ['./edit-group-member.dialog.component.scss'] +}) +export class EditGroupMemberDialogComponent implements OnInit { + constructor( + public dialogRef: MatDialogRef< + EditGroupMemberDialogData, + EditGroupMemberDialogResult + >, + @Inject(MAT_DIALOG_DATA) public data: EditGroupMemberDialogData + ) {} + + ngOnInit(): void {} + + onClickChoice(choice: boolean): void { + this.dialogRef.close({ + choice + }); + } +} diff --git a/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/edit-group.dialog.component.html b/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/edit-group.dialog.component.html new file mode 100644 index 00000000..7e2dcc5e --- /dev/null +++ b/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/edit-group.dialog.component.html @@ -0,0 +1,18 @@ + + + 그룹 이름 수정 + + + + + + + diff --git a/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/edit-group.dialog.component.scss b/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/edit-group.dialog.component.scss new file mode 100644 index 00000000..e69de29b diff --git a/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/edit-group.dialog.component.spec.ts b/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/edit-group.dialog.component.spec.ts new file mode 100644 index 00000000..e279601d --- /dev/null +++ b/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/edit-group.dialog.component.spec.ts @@ -0,0 +1,24 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { EditGroupDialogComponent } from './edit-group.dialog.component'; + +describe('app::layouts::messenger::EditGroupDialogComponent', () => { + let component: EditGroupDialogComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [EditGroupDialogComponent] + }).compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(EditGroupDialogComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/edit-group.dialog.component.ts b/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/edit-group.dialog.component.ts new file mode 100644 index 00000000..cc70a84b --- /dev/null +++ b/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/edit-group.dialog.component.ts @@ -0,0 +1,31 @@ +import { Component, OnInit, Inject } from '@angular/core'; +import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material'; + +export interface EditGroupDialogData { + title: string; + message?: string; +} + +export interface EditGroupDialogResult { + choice: boolean; +} + +@Component({ + selector: 'app-layout-messenger-edit-group', + templateUrl: './edit-group.dialog.component.html', + styleUrls: ['./edit-group.dialog.component.scss'] +}) +export class EditGroupDialogComponent implements OnInit { + constructor( + public dialogRef: MatDialogRef, + @Inject(MAT_DIALOG_DATA) public data: EditGroupDialogData + ) {} + + ngOnInit(): void {} + + onClickChoice(choice: boolean): void { + this.dialogRef.close({ + choice + }); + } +} diff --git a/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/index.ts b/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/index.ts index dc006a67..dc3d41a7 100644 --- a/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/index.ts +++ b/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/index.ts @@ -1,3 +1,11 @@ import { CreateGroupDialogComponent } from './create-group.dialog.component'; +import { DeleteGroupDialogComponent } from './delete-group.dialog.component'; +import { EditGroupDialogComponent } from './edit-group.dialog.component'; +import { EditGroupMemberDialogComponent } from './edit-group-member.dialog.component'; -export const DIALOGS = [CreateGroupDialogComponent]; +export const DIALOGS = [ + CreateGroupDialogComponent, + DeleteGroupDialogComponent, + EditGroupDialogComponent, + EditGroupMemberDialogComponent +]; From 0dd36a92db68d0e3b3a5807d6e37f67e71a69c6b Mon Sep 17 00:00:00 2001 From: Richard Park Date: Wed, 16 Oct 2019 15:44:16 +0900 Subject: [PATCH 3/4] buddy click is modified --- .../messenger/components/left-sidenav/group.component.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 7b0478ae..68786c44 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 @@ -187,8 +187,8 @@ export class GroupComponent implements OnInit, OnDestroy { } onSelectBuddy(buddy: UserInfo) { - // this.store.dispatch(ChatStore.selectedRoom({ roomSeq: String(buddy.seq) })); this.logger.debug('onSelectBuddy', buddy); + this.store.dispatch(ChatStore.openRoom({ userSeqList: [buddy.seq] })); } getStatusBulkInfo(buddy: UserInfo) { From 0c1ae7ec64cf70666b7b821d234effbe62a08c0b Mon Sep 17 00:00:00 2001 From: Richard Park Date: Wed, 16 Oct 2019 16:33:19 +0900 Subject: [PATCH 4/4] contextMenu of messages is modified --- .../left-sidenav/group.component.ts | 3 +- .../components/messages.component.html | 93 +++++++++++++++++-- .../components/messages.component.ts | 59 +++++++++++- .../src/lib/models/info.ts | 16 ++++ .../lib/components/messages.component.html | 24 +---- .../src/lib/components/messages.component.ts | 38 ++------ 6 files changed, 166 insertions(+), 67 deletions(-) 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 68786c44..9388544b 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 @@ -60,11 +60,10 @@ export class GroupComponent implements OnInit, OnDestroy { @ViewChild('profileContextMenuTrigger', { static: true }) profileContextMenuTrigger: MatMenuTrigger; + profileContextMenuPosition = { x: '0px', y: '0px' }; @ViewChild('groupContextMenuTrigger', { static: true }) groupContextMenuTrigger: MatMenuTrigger; - - profileContextMenuPosition = { x: '0px', y: '0px' }; groupContextMenuPosition = { x: '0px', y: '0px' }; groupBuddyList$: Observable< diff --git a/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/messages.component.html b/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/messages.component.html index 4dab8b5c..0329993b 100644 --- a/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/messages.component.html +++ b/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/messages.component.html @@ -5,20 +5,37 @@
-
- - @@ -31,7 +48,10 @@
- +
@@ -39,9 +59,16 @@ - +
@@ -56,3 +83,49 @@
+ +
+ + + + + + + + + + + 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 68fd6ebe..76d8591e 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 @@ -10,7 +10,13 @@ import { ucapAnimations } from '@ucap-webmessenger/ui'; import { Store, select } from '@ngrx/store'; import { NGXLogger } from 'ngx-logger'; import { Observable, Subscription } from 'rxjs'; -import { Info, EventType } from '@ucap-webmessenger/protocol-event'; +import { + Info, + EventType, + isRecalled, + isCopyable, + isRecallable +} from '@ucap-webmessenger/protocol-event'; import * as AppStore from '@app/store'; import * as EventStore from '@app/store/messenger/event'; @@ -24,6 +30,7 @@ import { tap } from 'rxjs/operators'; import { FileInfo } from '@ucap-webmessenger/ui-chat'; import { KEY_VER_INFO } from '@app/types/ver-info.type'; import { VersionInfo2Response } from '@ucap-webmessenger/api-public'; +import { MatMenuTrigger } from '@angular/material'; @Component({ selector: 'app-layout-messenger-messages', @@ -35,6 +42,10 @@ export class MessagesComponent implements OnInit, OnDestroy, AfterViewChecked { @ViewChild('messageBoxContainer', { static: true }) private messageBoxContainer: ElementRef; + @ViewChild('messageContextMenuTrigger', { static: true }) + messageContextMenuTrigger: MatMenuTrigger; + messageContextMenuPosition = { x: '0px', y: '0px' }; + loginRes: LoginResponse; loginResSubscription: Subscription; eventList$: Observable; @@ -46,6 +57,10 @@ export class MessagesComponent implements OnInit, OnDestroy, AfterViewChecked { KEY_VER_INFO ); + isRecalledMessage = isRecalled; + isCopyableMessage = isCopyable; + isRecallableMessage = isRecallable; + constructor( private store: Store, private sessionStorageService: SessionStorageService, @@ -143,4 +158,46 @@ export class MessagesComponent implements OnInit, OnDestroy, AfterViewChecked { onSave(value: { fileInfo: FileInfo; type: string }) { this.logger.debug('fileSave', value); } + + onContextMenuMessage(params: { event: MouseEvent; message: Info }) { + params.event.preventDefault(); + params.event.stopPropagation(); + + this.messageContextMenuPosition.x = params.event.clientX + 'px'; + this.messageContextMenuPosition.y = params.event.clientY + 'px'; + this.messageContextMenuTrigger.menu.focusFirstItem('mouse'); + this.messageContextMenuTrigger.menuData = { + message: params.message, + loginRes: this.loginRes + }; + this.messageContextMenuTrigger.openMenu(); + } + + onClickMessageContextMenu(menuType: string, message: Info) { + switch (menuType) { + case 'COPY': + { + this.logger.debug('onClickMessageContextMenu', menuType, message); + } + break; + case 'REPLAY': + { + } + break; + case 'REPLAY_TO_ME': + { + } + break; + case 'DELETE': + { + } + break; + case 'RECALL': + { + } + break; + default: + break; + } + } } diff --git a/projects/ucap-webmessenger-protocol-event/src/lib/models/info.ts b/projects/ucap-webmessenger-protocol-event/src/lib/models/info.ts index fa28fc20..6f1b9ca9 100644 --- a/projects/ucap-webmessenger-protocol-event/src/lib/models/info.ts +++ b/projects/ucap-webmessenger-protocol-event/src/lib/models/info.ts @@ -14,3 +14,19 @@ export interface Info { // 수신자수 receiverCount: number; } + +export function isCopyable(eventType: EventType): boolean { + return ( + EventType.Character === eventType || EventType.Translation === eventType + ); +} + +export function isRecalled(eventType: EventType): boolean { + return EventType.RecalledMessage === eventType; +} + +export function isRecallable(event: Info, userSeq: number): boolean { + return ( + event.senderSeq === userSeq && event.type !== EventType.RecalledMessage + ); +} diff --git a/projects/ucap-webmessenger-ui-chat/src/lib/components/messages.component.html b/projects/ucap-webmessenger-ui-chat/src/lib/components/messages.component.html index 80bec251..522791c0 100644 --- a/projects/ucap-webmessenger-ui-chat/src/lib/components/messages.component.html +++ b/projects/ucap-webmessenger-ui-chat/src/lib/components/messages.component.html @@ -92,9 +92,7 @@
@@ -120,23 +118,3 @@
- -
- - - - - - - - - - - diff --git a/projects/ucap-webmessenger-ui-chat/src/lib/components/messages.component.ts b/projects/ucap-webmessenger-ui-chat/src/lib/components/messages.component.ts index e43b886f..7587dc46 100644 --- a/projects/ucap-webmessenger-ui-chat/src/lib/components/messages.component.ts +++ b/projects/ucap-webmessenger-ui-chat/src/lib/components/messages.component.ts @@ -43,10 +43,11 @@ export class MessagesComponent implements OnInit { @Output() save = new EventEmitter<{ fileInfo: FileInfo; type: string }>(); - @ViewChildren(MatMenuTrigger) menuTriggerList: QueryList; - @ViewChild('messageContextMenu', { static: true }) - messageContextMenu: MatMenu; - messageContextMenuPosition = { x: '0px', y: '0px' }; + @Output() + contextMenu = new EventEmitter<{ + event: MouseEvent; + message: Info; + }>(); EventType = EventType; profileImageRoot: string; @@ -126,23 +127,6 @@ export class MessagesComponent implements OnInit { return false; } - isCopyableMessage(eventType: EventType): boolean { - return ( - EventType.Character === eventType || EventType.Translation === eventType - ); - } - - isRecalledMessage(eventType: EventType): boolean { - return EventType.RecalledMessage === eventType; - } - - isRecallable(message: Info): boolean { - return ( - message.senderSeq === this.loginRes.userSeq && - message.type !== EventType.RecalledMessage - ); - } - /** [Event] MassTalk Detail View */ onMassDetail(value: number) { this.massDetail.emit(value); @@ -158,15 +142,7 @@ export class MessagesComponent implements OnInit { this.save.emit(value); } - onContextMenuMessage(event: MouseEvent, eventType: EventType, message: Info) { - event.preventDefault(); - - this.messageContextMenu.focusFirstItem('mouse'); - - this.messageContextMenuPosition.x = event.clientX + 'px'; - this.messageContextMenuPosition.y = event.clientY + 'px'; - const messageContextMenuTrigger = this.menuTriggerList.toArray()[0]; - messageContextMenuTrigger.menuData = { eventType, message }; - messageContextMenuTrigger.openMenu(); + onContextMenuMessage(event: MouseEvent, message: Info) { + this.contextMenu.emit({ event, message }); } }