2019-09-23 05:23:24 +00:00
|
|
|
import { Component, OnInit } from '@angular/core';
|
|
|
|
import { ucapAnimations } from '@ucap-webmessenger/ui';
|
2019-10-02 09:09:39 +00:00
|
|
|
import { NGXLogger } from 'ngx-logger';
|
|
|
|
import { Store, select } from '@ngrx/store';
|
|
|
|
import { Observable } from 'rxjs';
|
|
|
|
import { RoomInfo } from '@ucap-webmessenger/protocol-room';
|
|
|
|
import * as AppStore from '@app/store';
|
2019-10-08 02:19:47 +00:00
|
|
|
import * as ChatStore from '@app/store/messenger/chat';
|
2019-09-23 05:23:24 +00:00
|
|
|
|
|
|
|
@Component({
|
|
|
|
selector: 'app-layout-chat-left-sidenav-chat',
|
|
|
|
templateUrl: './chat.component.html',
|
|
|
|
styleUrls: ['./chat.component.scss'],
|
|
|
|
animations: ucapAnimations
|
|
|
|
})
|
|
|
|
export class ChatComponent implements OnInit {
|
2019-10-02 09:09:39 +00:00
|
|
|
roomList$: Observable<RoomInfo[]>;
|
2019-09-23 05:23:24 +00:00
|
|
|
|
2019-10-02 09:09:39 +00:00
|
|
|
constructor(private store: Store<any>, private logger: NGXLogger) {}
|
|
|
|
|
|
|
|
ngOnInit() {
|
|
|
|
this.roomList$ = this.store.pipe(
|
|
|
|
select(AppStore.MessengerSelector.SyncSelector.roomList)
|
|
|
|
);
|
|
|
|
}
|
2019-10-08 02:19:47 +00:00
|
|
|
|
|
|
|
onSelectedRoom(roomInfo: RoomInfo) {
|
|
|
|
this.store.dispatch(ChatStore.selectedRoom({ roomSeq: roomInfo.roomSeq }));
|
|
|
|
}
|
2019-09-23 05:23:24 +00:00
|
|
|
}
|