2019-01-13 19:34:38 +00:00
|
|
|
// @flow
|
|
|
|
|
|
|
|
import React from 'react';
|
|
|
|
|
|
|
|
import { translate } from '../../../base/i18n';
|
2020-04-01 15:14:02 +00:00
|
|
|
import { JitsiModal } from '../../../base/modal';
|
2019-03-21 16:38:29 +00:00
|
|
|
import { connect } from '../../../base/redux';
|
2020-04-01 15:14:02 +00:00
|
|
|
import { CHAT_VIEW_MODAL_ID } from '../../constants';
|
2019-01-13 19:34:38 +00:00
|
|
|
import AbstractChat, {
|
|
|
|
_mapDispatchToProps,
|
2020-04-01 15:14:02 +00:00
|
|
|
_mapStateToProps,
|
|
|
|
type Props
|
2019-01-13 19:34:38 +00:00
|
|
|
} from '../AbstractChat';
|
|
|
|
|
2019-04-25 13:17:49 +00:00
|
|
|
import ChatInputBar from './ChatInputBar';
|
|
|
|
import MessageContainer from './MessageContainer';
|
2019-10-07 12:35:04 +00:00
|
|
|
import MessageRecipient from './MessageRecipient';
|
2019-01-13 19:34:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Implements a React native component that renders the chat window (modal) of
|
|
|
|
* the mobile client.
|
|
|
|
*/
|
|
|
|
class Chat extends AbstractChat<Props> {
|
2020-07-23 11:56:45 +00:00
|
|
|
/**
|
2020-07-23 13:17:33 +00:00
|
|
|
* Creates a new instance.
|
2020-07-23 11:56:45 +00:00
|
|
|
*
|
|
|
|
* @inheritdoc
|
|
|
|
*/
|
|
|
|
constructor(props: Props) {
|
|
|
|
super(props);
|
|
|
|
|
|
|
|
this._onClose = this._onClose.bind(this);
|
|
|
|
}
|
|
|
|
|
2019-01-13 19:34:38 +00:00
|
|
|
/**
|
|
|
|
* Implements React's {@link Component#render()}.
|
|
|
|
*
|
|
|
|
* @inheritdoc
|
|
|
|
*/
|
|
|
|
render() {
|
|
|
|
return (
|
2020-04-01 15:14:02 +00:00
|
|
|
<JitsiModal
|
2020-04-06 15:14:32 +00:00
|
|
|
headerProps = {{
|
|
|
|
headerLabelKey: 'chat.title'
|
|
|
|
}}
|
2020-07-23 09:42:19 +00:00
|
|
|
modalId = { CHAT_VIEW_MODAL_ID }
|
2020-07-23 11:56:45 +00:00
|
|
|
onClose = { this._onClose }>
|
2020-07-23 09:42:19 +00:00
|
|
|
|
2020-04-06 15:14:32 +00:00
|
|
|
<MessageContainer messages = { this.props._messages } />
|
|
|
|
<MessageRecipient />
|
|
|
|
<ChatInputBar onSend = { this.props._onSendMessage } />
|
2020-04-01 15:14:02 +00:00
|
|
|
</JitsiModal>
|
2019-01-13 19:34:38 +00:00
|
|
|
);
|
|
|
|
}
|
2020-07-23 11:56:45 +00:00
|
|
|
|
|
|
|
_onClose: () => boolean
|
|
|
|
|
|
|
|
/**
|
2020-07-23 13:17:15 +00:00
|
|
|
* Closes the modal.
|
2020-07-23 11:56:45 +00:00
|
|
|
*
|
|
|
|
* @returns {boolean}
|
|
|
|
*/
|
|
|
|
_onClose() {
|
|
|
|
this.props._onToggleChat();
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
2019-10-15 14:08:23 +00:00
|
|
|
}
|
|
|
|
|
2019-01-13 19:34:38 +00:00
|
|
|
export default translate(connect(_mapStateToProps, _mapDispatchToProps)(Chat));
|