From b2e19334703b7e026323cd288a4fedef89d7d024 Mon Sep 17 00:00:00 2001 From: leejh Date: Mon, 14 Oct 2019 15:33:21 +0900 Subject: [PATCH] modify message-box in Information by JOIN, EXIT --- .../message-box/information.component.html | 3 ++ .../message-box/information.component.ts | 31 +++++++++++++++++-- .../lib/components/messages.component.html | 10 +++--- 3 files changed, 36 insertions(+), 8 deletions(-) diff --git a/projects/ucap-webmessenger-ui-chat/src/lib/components/message-box/information.component.html b/projects/ucap-webmessenger-ui-chat/src/lib/components/message-box/information.component.html index e69de29b..899a0e49 100644 --- a/projects/ucap-webmessenger-ui-chat/src/lib/components/message-box/information.component.html +++ b/projects/ucap-webmessenger-ui-chat/src/lib/components/message-box/information.component.html @@ -0,0 +1,3 @@ +

+ {{ contents }} +

diff --git a/projects/ucap-webmessenger-ui-chat/src/lib/components/message-box/information.component.ts b/projects/ucap-webmessenger-ui-chat/src/lib/components/message-box/information.component.ts index 07cc2370..7c3947d8 100644 --- a/projects/ucap-webmessenger-ui-chat/src/lib/components/message-box/information.component.ts +++ b/projects/ucap-webmessenger-ui-chat/src/lib/components/message-box/information.component.ts @@ -1,4 +1,6 @@ -import { Component, OnInit } from '@angular/core'; +import { Component, OnInit, Input } from '@angular/core'; +import { NGXLogger } from 'ngx-logger'; +import { Info, EventType } from '@ucap-webmessenger/protocol-event'; @Component({ selector: 'ucap-chat-message-box-information', @@ -6,7 +8,30 @@ import { Component, OnInit } from '@angular/core'; styleUrls: ['./information.component.scss'] }) export class InformationComponent implements OnInit { - constructor() {} + @Input() + message: Info; - ngOnInit() {} + contents: string; + + constructor(private logger: NGXLogger) {} + + ngOnInit() { + switch (this.message.type) { + case EventType.Join: + let owner: string; + const inviter: string[] = []; + this.message.sentMessage.split(',').forEach((userName, idx) => { + if (idx === 0) { + owner = userName + '님'; + } else { + inviter.push(userName + '님'); + } + }); + this.contents = `${owner}이 ${inviter.join(',')}을 초대했습니다.`; + break; + case EventType.Exit: + this.contents = `${this.message.sentMessage}님이 퇴장하셨습니다.`; + break; + } + } } 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 a3145351..ac16142c 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 @@ -4,7 +4,7 @@ me: message.senderSeq === loginRes.userSeq, contact: message.senderSeq !== loginRes.userSeq }"> -
+
- + + + + -
Join
date splitter - information - mass-translation notice