modify chat message component / TEXT
modify userinfo in chat event list
This commit is contained in:
parent
55d593904b
commit
be0e24b922
|
@ -5,23 +5,14 @@
|
||||||
<div fxFlex fxLayout="row" fxLayoutAlign="space-between center">
|
<div fxFlex fxLayout="row" fxLayoutAlign="space-between center">
|
||||||
<div fxLayout="row" fxLayoutAlign="start center">
|
<div fxLayout="row" fxLayoutAlign="start center">
|
||||||
<!-- RESPONSIVE CHATS BUTTON-->
|
<!-- RESPONSIVE CHATS BUTTON-->
|
||||||
<button
|
<button mat-icon-button aria-label="chats button" fxHide.gt-md class="responsive-chats-button">
|
||||||
mat-icon-button
|
|
||||||
aria-label="chats button"
|
|
||||||
fxHide.gt-md
|
|
||||||
class="responsive-chats-button"
|
|
||||||
>
|
|
||||||
<mat-icon>chat</mat-icon>
|
<mat-icon>chat</mat-icon>
|
||||||
</button>
|
</button>
|
||||||
<!-- / RESPONSIVE CHATS BUTTON-->
|
<!-- / RESPONSIVE CHATS BUTTON-->
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<button
|
<button mat-icon-button [matMenuTriggerFor]="contactMenu" aria-label="more">
|
||||||
mat-icon-button
|
|
||||||
[matMenuTriggerFor]="contactMenu"
|
|
||||||
aria-label="more"
|
|
||||||
>
|
|
||||||
<mat-icon>more_vert</mat-icon>
|
<mat-icon>more_vert</mat-icon>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
|
@ -34,17 +25,12 @@
|
||||||
</div>
|
</div>
|
||||||
</mat-toolbar>
|
</mat-toolbar>
|
||||||
<!-- / CHAT TOOLBAR -->
|
<!-- / CHAT TOOLBAR -->
|
||||||
<mat-progress-bar
|
<mat-progress-bar *ngIf="eventListProcessing$ | async" mode="indeterminate"></mat-progress-bar>
|
||||||
*ngIf="eventListProcessing$ | async"
|
|
||||||
mode="indeterminate"
|
|
||||||
></mat-progress-bar>
|
|
||||||
<!-- CHAT CONTENT -->
|
<!-- CHAT CONTENT -->
|
||||||
<div fxFlex="1 1 auto" class="chat-content" #messageBoxContainer>
|
<div fxFlex="1 1 auto" class="chat-content" #messageBoxContainer>
|
||||||
<!-- CHAT MESSAGES -->
|
<!-- CHAT MESSAGES -->
|
||||||
<ucap-chat-messages
|
<ucap-chat-messages [messages]="eventList$ | async" [userInfos]="userInfoList$ | async" [loginRes]="loginRes">
|
||||||
[messages]="eventList$ | async"
|
</ucap-chat-messages>
|
||||||
[loginRes]="loginRes"
|
|
||||||
></ucap-chat-messages>
|
|
||||||
<!-- CHAT MESSAGES -->
|
<!-- CHAT MESSAGES -->
|
||||||
</div>
|
</div>
|
||||||
<!-- / CHAT CONTENT -->
|
<!-- / CHAT CONTENT -->
|
||||||
|
|
|
@ -17,7 +17,7 @@ import * as EventStore from '@app/store/messenger/event';
|
||||||
import { LoginResponse } from '@ucap-webmessenger/protocol-authentication';
|
import { LoginResponse } from '@ucap-webmessenger/protocol-authentication';
|
||||||
import { SessionStorageService } from '@ucap-webmessenger/web-storage';
|
import { SessionStorageService } from '@ucap-webmessenger/web-storage';
|
||||||
import { LoginInfo, KEY_LOGIN_INFO } from '@app/types';
|
import { LoginInfo, KEY_LOGIN_INFO } from '@app/types';
|
||||||
import { RoomInfo } from '@ucap-webmessenger/protocol-room';
|
import { RoomInfo, UserInfo } from '@ucap-webmessenger/protocol-room';
|
||||||
import { tap } from 'rxjs/operators';
|
import { tap } from 'rxjs/operators';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
|
@ -35,6 +35,7 @@ export class MessagesComponent implements OnInit, OnDestroy, AfterViewChecked {
|
||||||
eventList$: Observable<Info[]>;
|
eventList$: Observable<Info[]>;
|
||||||
roomInfo: RoomInfo;
|
roomInfo: RoomInfo;
|
||||||
roomInfoSubscription: Subscription;
|
roomInfoSubscription: Subscription;
|
||||||
|
userInfoList$: Observable<UserInfo[]>;
|
||||||
eventListProcessing$: Observable<boolean>;
|
eventListProcessing$: Observable<boolean>;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
|
@ -64,6 +65,10 @@ export class MessagesComponent implements OnInit, OnDestroy, AfterViewChecked {
|
||||||
)
|
)
|
||||||
.subscribe();
|
.subscribe();
|
||||||
|
|
||||||
|
this.userInfoList$ = this.store.pipe(
|
||||||
|
select(AppStore.MessengerSelector.RoomSelector.userInfoList)
|
||||||
|
);
|
||||||
|
|
||||||
this.eventListProcessing$ = this.store.pipe(
|
this.eventListProcessing$ = this.store.pipe(
|
||||||
select(AppStore.MessengerSelector.EventSelector.infoListProcessing)
|
select(AppStore.MessengerSelector.EventSelector.infoListProcessing)
|
||||||
);
|
);
|
||||||
|
|
|
@ -1,48 +1,48 @@
|
||||||
export enum EventType {
|
export enum EventType {
|
||||||
// J: 대화참여
|
/** J: 대화참여 */
|
||||||
Join = 'J',
|
Join = 'J',
|
||||||
// C: 대화전송
|
/** C: 대화전송 */
|
||||||
Character = 'C',
|
Character = 'C',
|
||||||
// F: 파일전송
|
/** F: 파일전송 */
|
||||||
File = 'F',
|
File = 'F',
|
||||||
// S: 스티커
|
/** S: 스티커 */
|
||||||
Sticker = 'S',
|
Sticker = 'S',
|
||||||
// T: Mass Text
|
/** T: Mass Text */
|
||||||
MassText = 'T',
|
MassText = 'T',
|
||||||
// E: 대화퇴장
|
/** E: 대화퇴장 */
|
||||||
Exit = 'E',
|
Exit = 'E',
|
||||||
// P: 일정
|
/** P: 일정 */
|
||||||
Plan = 'P',
|
Plan = 'P',
|
||||||
// V: 화상회의
|
/** V: 화상회의 */
|
||||||
VideoConference = 'V',
|
VideoConference = 'V',
|
||||||
// L: 링크(Legacy)
|
/** L: 링크(Legacy) */
|
||||||
Link = 'L',
|
Link = 'L',
|
||||||
// R: 대화방명변경
|
/** R: 대화방명변경 */
|
||||||
RenameRoom = 'R',
|
RenameRoom = 'R',
|
||||||
// Y: 번역
|
/** Y: 번역 */
|
||||||
Translation = 'Y',
|
Translation = 'Y',
|
||||||
// Z: 대용량 번역
|
/** Z: 대용량 번역 */
|
||||||
MassTranslation = 'Z',
|
MassTranslation = 'Z',
|
||||||
// U: 회수된 메시지
|
/** U: 회수된 메시지 */
|
||||||
RecalledMessage = 'U',
|
RecalledMessage = 'U',
|
||||||
// N: 방Timer 변경 안내
|
/** N: 방Timer 변경 안내 */
|
||||||
GuideForRoomTimerChanged = 'N',
|
GuideForRoomTimerChanged = 'N',
|
||||||
// X: iOS캡쳐알림
|
/** X: iOS캡쳐알림 */
|
||||||
NotificationForiOSCapture = 'X',
|
NotificationForiOSCapture = 'X',
|
||||||
// B: 타이머대화방알림
|
/** B: 타이머대화방알림 */
|
||||||
NotificationForTimerRoom = 'B',
|
NotificationForTimerRoom = 'B',
|
||||||
// Q: 2개월전 메시지
|
/** Q: 2개월전 메시지 */
|
||||||
Before2MonthsAgo = 'Q',
|
Before2MonthsAgo = 'Q',
|
||||||
// G: 강제 퇴장
|
/** G: 강제 퇴장 */
|
||||||
ForcedExit = 'G',
|
ForcedExit = 'G',
|
||||||
// H: 챗봇대화 시작
|
/** H: 챗봇대화 시작 */
|
||||||
ChatbotStart = 'H',
|
ChatbotStart = 'H',
|
||||||
// K: 챗봇대화 종료
|
/** K: 챗봇대화 종료 */
|
||||||
ChatbotEnd = 'K',
|
ChatbotEnd = 'K',
|
||||||
// I: 챗봇대화 전송
|
/** I: 챗봇대화 전송 */
|
||||||
ChatbotSend = 'I',
|
ChatbotSend = 'I',
|
||||||
// A: 챗봇 대용량 대화 전송
|
/** A: 챗봇 대용량 대화 전송 */
|
||||||
ChatbotSendMass = 'A',
|
ChatbotSendMass = 'A',
|
||||||
// M: 동영상 스트리밍
|
/** M: 동영상 스트리밍 */
|
||||||
VideoStreamming = 'M'
|
VideoStreamming = 'M'
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
<p>
|
||||||
|
<span>
|
||||||
|
{{ message.sentMessage }}
|
||||||
|
</span>
|
||||||
|
<span>
|
||||||
|
{{ message.sendDate | date: 'short' }}
|
||||||
|
</span>
|
||||||
|
</p>
|
|
@ -1,4 +1,5 @@
|
||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit, Input } from '@angular/core';
|
||||||
|
import { Info } from '@ucap-webmessenger/protocol-event';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ucap-chat-message-box-mass',
|
selector: 'ucap-chat-message-box-mass',
|
||||||
|
@ -6,6 +7,9 @@ import { Component, OnInit } from '@angular/core';
|
||||||
styleUrls: ['./mass.component.scss']
|
styleUrls: ['./mass.component.scss']
|
||||||
})
|
})
|
||||||
export class MassComponent implements OnInit {
|
export class MassComponent implements OnInit {
|
||||||
|
@Input()
|
||||||
|
message: Info;
|
||||||
|
|
||||||
constructor() {}
|
constructor() {}
|
||||||
|
|
||||||
ngOnInit() {}
|
ngOnInit() {}
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
<p>
|
||||||
|
<span>
|
||||||
|
{{ message.sentMessage }}
|
||||||
|
</span>
|
||||||
|
<span>
|
||||||
|
{{ message.sendDate | date: 'short' }}
|
||||||
|
</span>
|
||||||
|
</p>
|
|
@ -1,4 +1,5 @@
|
||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit, Input } from '@angular/core';
|
||||||
|
import { Info } from '@ucap-webmessenger/protocol-event';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ucap-chat-message-box-text',
|
selector: 'ucap-chat-message-box-text',
|
||||||
|
@ -6,6 +7,9 @@ import { Component, OnInit } from '@angular/core';
|
||||||
styleUrls: ['./text.component.scss']
|
styleUrls: ['./text.component.scss']
|
||||||
})
|
})
|
||||||
export class TextComponent implements OnInit {
|
export class TextComponent implements OnInit {
|
||||||
|
@Input()
|
||||||
|
message: Info;
|
||||||
|
|
||||||
constructor() {}
|
constructor() {}
|
||||||
|
|
||||||
ngOnInit() {}
|
ngOnInit() {}
|
||||||
|
|
|
@ -1,27 +1,60 @@
|
||||||
<div class="chat-messages">
|
<div class="chat-messages">
|
||||||
<!-- MESSAGE -->
|
<!-- MESSAGE -->
|
||||||
<div
|
<div *ngFor="let message of messages; let i = index" class="message-row" [ngClass]="{
|
||||||
*ngFor="let message of messages; let i = index"
|
|
||||||
class="message-row"
|
|
||||||
[ngClass]="{
|
|
||||||
me: message.senderSeq === loginRes.userSeq,
|
me: message.senderSeq === loginRes.userSeq,
|
||||||
contact: message.senderSeq !== loginRes.userSeq
|
contact: message.senderSeq !== loginRes.userSeq
|
||||||
}"
|
}">
|
||||||
>
|
<div>
|
||||||
|
<ul>
|
||||||
|
<li *ngIf="getUserProfile(message.senderSeq) != ''">
|
||||||
|
<img [src]="getUserProfile(message.senderSeq)" onerror="this.src='assets/images/img_nophoto_50.png'"
|
||||||
|
class="avatar" style="width: 50px; height: 50px;" />
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
{{ getUserName(message.senderSeq) }}
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
<ng-container [ngSwitch]="message.type">
|
<ng-container [ngSwitch]="message.type">
|
||||||
<div *ngSwitchCase="EventType.Character">Character</div>
|
<ucap-chat-message-box-text *ngSwitchCase="EventType.Character" [message]="message"></ucap-chat-message-box-text>
|
||||||
|
<ucap-chat-message-box-mass *ngSwitchCase="EventType.MassText" [message]="message"></ucap-chat-message-box-mass>
|
||||||
<div *ngSwitchCase="EventType.Join">Join</div>
|
<div *ngSwitchCase="EventType.Join">Join</div>
|
||||||
|
<div *ngSwitchDefault>
|
||||||
|
date splitter
|
||||||
|
<ucap-chat-message-box-date-splitter></ucap-chat-message-box-date-splitter>
|
||||||
|
file
|
||||||
|
<ucap-chat-message-box-file></ucap-chat-message-box-file>
|
||||||
|
image
|
||||||
|
<ucap-chat-message-box-image></ucap-chat-message-box-image>
|
||||||
|
information
|
||||||
|
<ucap-chat-message-box-information></ucap-chat-message-box-information>
|
||||||
|
mass-translation
|
||||||
|
<ucap-chat-message-box-mass-translation></ucap-chat-message-box-mass-translation>
|
||||||
|
notice
|
||||||
|
<ucap-chat-message-box-notice></ucap-chat-message-box-notice>
|
||||||
|
recall
|
||||||
|
<ucap-chat-message-box-recall></ucap-chat-message-box-recall>
|
||||||
|
<ucap-chat-message-box-schedule></ucap-chat-message-box-schedule>
|
||||||
|
sticker
|
||||||
|
<ucap-chat-message-box-sticker></ucap-chat-message-box-sticker>
|
||||||
|
translation
|
||||||
|
<ucap-chat-message-box-translation></ucap-chat-message-box-translation>
|
||||||
|
video
|
||||||
|
<ucap-chat-message-box-video></ucap-chat-message-box-video>
|
||||||
|
video-conference
|
||||||
|
<ucap-chat-message-box-video-conference></ucap-chat-message-box-video-conference>
|
||||||
|
|
||||||
|
<div class="bubble">
|
||||||
|
<div class="message">
|
||||||
|
{{ message.sentMessage }}
|
||||||
|
</div>
|
||||||
|
<div class="time secondary-text">
|
||||||
|
{{ message.sendDate | date: 'short' }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
|
||||||
<img *ngIf="" src="" class="avatar" />
|
|
||||||
|
|
||||||
<div class="bubble">
|
|
||||||
<div class="message">
|
|
||||||
{{ message.sentMessage }}
|
|
||||||
</div>
|
|
||||||
<div class="time secondary-text">
|
|
||||||
{{ message.sendDate | date: 'short' }}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,8 +1,13 @@
|
||||||
import { Component, OnInit, Input } from '@angular/core';
|
import { Component, OnInit, Input } from '@angular/core';
|
||||||
|
|
||||||
import { Info, EventType } from '@ucap-webmessenger/protocol-event';
|
import { Info, EventType } from '@ucap-webmessenger/protocol-event';
|
||||||
import { LoginResponse } from '@ucap-webmessenger/protocol-authentication';
|
import {
|
||||||
|
LoginResponse,
|
||||||
|
UserInfo
|
||||||
|
} from '@ucap-webmessenger/protocol-authentication';
|
||||||
import { NGXLogger } from 'ngx-logger';
|
import { NGXLogger } from 'ngx-logger';
|
||||||
|
import { SessionStorageService } from '@ucap-webmessenger/web-storage';
|
||||||
|
import { KEY_VER_INFO, VerInfo2 } from '@app/types/ver-info.type';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ucap-chat-messages',
|
selector: 'ucap-chat-messages',
|
||||||
|
@ -14,12 +19,38 @@ export class MessagesComponent implements OnInit {
|
||||||
loginRes: LoginResponse;
|
loginRes: LoginResponse;
|
||||||
@Input()
|
@Input()
|
||||||
messages: Info[];
|
messages: Info[];
|
||||||
|
@Input()
|
||||||
|
userInfos?: UserInfo[];
|
||||||
|
|
||||||
EventType = EventType;
|
EventType = EventType;
|
||||||
|
profileImageRoot: string;
|
||||||
|
|
||||||
constructor(private logger: NGXLogger) {}
|
constructor(
|
||||||
|
private logger: NGXLogger,
|
||||||
|
private sessionStorageService: SessionStorageService
|
||||||
|
) {}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.logger.debug('type of userSeq', typeof this.loginRes.userSeq);
|
const verInfo = this.sessionStorageService.get<VerInfo2>(KEY_VER_INFO);
|
||||||
|
this.profileImageRoot = this.profileImageRoot || verInfo.profileRoot;
|
||||||
|
}
|
||||||
|
|
||||||
|
getUserName(seq: number): string {
|
||||||
|
const userInfo: UserInfo[] = this.userInfos.filter(
|
||||||
|
user => user.seq === seq
|
||||||
|
);
|
||||||
|
if (!!userInfo && userInfo.length > 0) {
|
||||||
|
return userInfo[0].name;
|
||||||
|
}
|
||||||
|
return '(알수없는 사용자)';
|
||||||
|
}
|
||||||
|
getUserProfile(seq: number): string {
|
||||||
|
const userInfo: UserInfo[] = this.userInfos.filter(
|
||||||
|
user => user.seq === seq
|
||||||
|
);
|
||||||
|
if (!!userInfo && userInfo.length > 0) {
|
||||||
|
return this.profileImageRoot + userInfo[0].profileImageFile;
|
||||||
|
}
|
||||||
|
return '';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user