You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Chat.js 1.7KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. // @flow
  2. import React from 'react';
  3. import { translate } from '../../../base/i18n';
  4. import { JitsiModal } from '../../../base/modal';
  5. import { connect } from '../../../base/redux';
  6. import { closeChat } from '../../actions.any';
  7. import { CHAT_VIEW_MODAL_ID } from '../../constants';
  8. import AbstractChat, {
  9. _mapStateToProps,
  10. type Props
  11. } from '../AbstractChat';
  12. import ChatInputBar from './ChatInputBar';
  13. import MessageContainer from './MessageContainer';
  14. import MessageRecipient from './MessageRecipient';
  15. /**
  16. * Implements a React native component that renders the chat window (modal) of
  17. * the mobile client.
  18. */
  19. class Chat extends AbstractChat<Props> {
  20. /**
  21. * Creates a new instance.
  22. *
  23. * @inheritdoc
  24. */
  25. constructor(props: Props) {
  26. super(props);
  27. this._onClose = this._onClose.bind(this);
  28. }
  29. /**
  30. * Implements React's {@link Component#render()}.
  31. *
  32. * @inheritdoc
  33. */
  34. render() {
  35. return (
  36. <JitsiModal
  37. headerProps = {{
  38. headerLabelKey: 'chat.title'
  39. }}
  40. modalId = { CHAT_VIEW_MODAL_ID }
  41. onClose = { this._onClose }
  42. showHeaderWithNavigation = { true }>
  43. <MessageContainer messages = { this.props._messages } />
  44. <MessageRecipient />
  45. <ChatInputBar onSend = { this._onSendMessage } />
  46. </JitsiModal>
  47. );
  48. }
  49. _onSendMessage: (string) => void;
  50. _onClose: () => boolean
  51. /**
  52. * Closes the modal.
  53. *
  54. * @returns {boolean}
  55. */
  56. _onClose() {
  57. this.props.dispatch(closeChat());
  58. return true;
  59. }
  60. }
  61. export default translate(connect(_mapStateToProps)(Chat));