2019-10-10 15:50:50 +09:00
|
|
|
import { Component, OnInit, Input } from '@angular/core';
|
|
|
|
import {
|
|
|
|
RoomInfo,
|
|
|
|
UserInfoShort,
|
|
|
|
UserInfo as RoomUserInfo
|
|
|
|
} from '@ucap-webmessenger/protocol-room';
|
|
|
|
import { NGXLogger } from 'ngx-logger';
|
2019-10-15 16:59:05 +09:00
|
|
|
import { VersionInfo2Response } from '@ucap-webmessenger/api-public';
|
2019-10-10 15:50:50 +09:00
|
|
|
|
|
|
|
@Component({
|
|
|
|
selector: 'ucap-room-list-item',
|
|
|
|
templateUrl: './list-item.component.html',
|
|
|
|
styleUrls: ['./list-item.component.scss']
|
|
|
|
})
|
|
|
|
export class ListItemComponent implements OnInit {
|
|
|
|
@Input()
|
|
|
|
roomInfo: RoomInfo;
|
|
|
|
@Input()
|
|
|
|
roomUserInfo: RoomUserInfo[] | UserInfoShort[];
|
2019-10-15 16:59:05 +09:00
|
|
|
@Input()
|
|
|
|
sessionVerinfo: VersionInfo2Response;
|
2019-10-10 15:50:50 +09:00
|
|
|
|
|
|
|
constructor(private logger: NGXLogger) {}
|
|
|
|
|
|
|
|
ngOnInit() {
|
|
|
|
// this.logger.debug(this.roomInfo);
|
|
|
|
}
|
|
|
|
|
|
|
|
getRoomName(roomInfo: RoomInfo): string {
|
|
|
|
if (!!roomInfo.roomName && '' !== roomInfo.roomName.trim()) {
|
|
|
|
return roomInfo.roomName;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!!this.roomUserInfo && 0 < this.roomUserInfo.length) {
|
|
|
|
let roomName = '';
|
|
|
|
this.roomUserInfo.forEach((roomUserInfo, index) => {
|
|
|
|
if (0 === index) {
|
|
|
|
roomName = roomName.concat('', roomUserInfo.name);
|
|
|
|
} else {
|
|
|
|
roomName = roomName.concat(',', roomUserInfo.name);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
return roomName;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|