modify message-box in Information by JOIN, EXIT

This commit is contained in:
leejh 2019-10-14 15:33:21 +09:00
parent 3ab5edbe53
commit b2e1933470
3 changed files with 36 additions and 8 deletions

View File

@ -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({ @Component({
selector: 'ucap-chat-message-box-information', selector: 'ucap-chat-message-box-information',
@ -6,7 +8,30 @@ import { Component, OnInit } from '@angular/core';
styleUrls: ['./information.component.scss'] styleUrls: ['./information.component.scss']
}) })
export class InformationComponent implements OnInit { 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;
}
}
} }

View File

@ -4,7 +4,7 @@
me: message.senderSeq === loginRes.userSeq, me: message.senderSeq === loginRes.userSeq,
contact: message.senderSeq !== loginRes.userSeq contact: message.senderSeq !== loginRes.userSeq
}"> }">
<div> <div *ngIf="message.type !== EventType.Join && message.type !== EventType.Exit">
<ul> <ul>
<li *ngIf="getUserProfile(message.senderSeq) != ''"> <li *ngIf="getUserProfile(message.senderSeq) != ''">
<img [src]="getUserProfile(message.senderSeq)" onerror="this.src='assets/images/img_nophoto_50.png'" <img [src]="getUserProfile(message.senderSeq)" onerror="this.src='assets/images/img_nophoto_50.png'"
@ -16,19 +16,19 @@
</ul> </ul>
</div> </div>
<ng-container [ngSwitch]="message.type"> <ng-container [ngSwitch]="message.type">
<ucap-chat-message-box-text *ngSwitchCase="EventType.Character" [message]="message"></ucap-chat-message-box-text> <ucap-chat-message-box-information *ngSwitchCase="EventType.Join" [message]="message">
</ucap-chat-message-box-information>
<ucap-chat-message-box-information *ngSwitchCase="EventType.Exit" [message]="message">
</ucap-chat-message-box-information>
<ucap-chat-message-box-mass *ngSwitchCase="EventType.MassText" [message]="message" <ucap-chat-message-box-mass *ngSwitchCase="EventType.MassText" [message]="message"
(massDetail)="onMassDetail($event)"> (massDetail)="onMassDetail($event)">
</ucap-chat-message-box-mass> </ucap-chat-message-box-mass>
<ucap-chat-message-box-file *ngSwitchCase="EventType.File" [message]="message" (save)="onSave($event)" <ucap-chat-message-box-file *ngSwitchCase="EventType.File" [message]="message" (save)="onSave($event)"
(imageViewer)="onImageViewer($event)"> (imageViewer)="onImageViewer($event)">
</ucap-chat-message-box-file> </ucap-chat-message-box-file>
<div *ngSwitchCase="EventType.Join">Join</div>
<div *ngSwitchDefault> <div *ngSwitchDefault>
date splitter date splitter
<ucap-chat-message-box-date-splitter></ucap-chat-message-box-date-splitter> <ucap-chat-message-box-date-splitter></ucap-chat-message-box-date-splitter>
information
<ucap-chat-message-box-information></ucap-chat-message-box-information>
mass-translation mass-translation
<ucap-chat-message-box-mass-translation></ucap-chat-message-box-mass-translation> <ucap-chat-message-box-mass-translation></ucap-chat-message-box-mass-translation>
notice notice