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.

DialogContainer.js 1.5KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. import React from 'react';
  2. import { ReactionEmoji } from '../../../../reactions/components';
  3. import { getReactionsQueue } from '../../../../reactions/functions.any';
  4. import { connect } from '../../../redux';
  5. import AbstractDialogContainer, {
  6. abstractMapStateToProps
  7. } from '../AbstractDialogContainer';
  8. /**
  9. * Implements a DialogContainer responsible for showing all dialogs. We will
  10. * need a separate container so we can handle multiple dialogs by showing them
  11. * simultaneously or queueing them.
  12. *
  13. * @extends AbstractDialogContainer
  14. */
  15. class DialogContainer extends AbstractDialogContainer {
  16. /**
  17. * Returns the reactions to be displayed.
  18. *
  19. * @returns {Array<React$Element>}
  20. */
  21. _renderReactions() {
  22. const { _reactionsQueue } = this.props;
  23. return _reactionsQueue.map(({ reaction, uid }, index) => (<ReactionEmoji
  24. index = { index }
  25. key = { uid }
  26. reaction = { reaction }
  27. uid = { uid } />));
  28. }
  29. /**
  30. * Implements React's {@link Component#render()}.
  31. *
  32. * @inheritdoc
  33. * @returns {ReactElement}
  34. */
  35. render() {
  36. return (<React.Fragment>
  37. {this._renderReactions()}
  38. {this._renderDialogContent()}
  39. </React.Fragment>);
  40. }
  41. }
  42. const mapStateToProps = state => {
  43. return {
  44. ...abstractMapStateToProps(state),
  45. _reactionsQueue: getReactionsQueue(state)
  46. };
  47. };
  48. export default connect(mapStateToProps)(DialogContainer);