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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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. <MessageContainer messages = { this.props._messages } />
  43. <MessageRecipient />
  44. <ChatInputBar onSend = { this._onSendMessage } />
  45. </JitsiModal>
  46. );
  47. }
  48. _onSendMessage: (string) => void;
  49. _onClose: () => boolean
  50. /**
  51. * Closes the modal.
  52. *
  53. * @returns {boolean}
  54. */
  55. _onClose() {
  56. this.props.dispatch(closeChat());
  57. return true;
  58. }
  59. }
  60. export default translate(connect(_mapStateToProps)(Chat));