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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. import React, { Fragment } 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. * @augments 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 (
  37. <Fragment>
  38. {this._renderReactions()}
  39. {this._renderDialogContent()}
  40. </Fragment>
  41. );
  42. }
  43. }
  44. const mapStateToProps = state => {
  45. return {
  46. ...abstractMapStateToProps(state),
  47. _reactionsQueue: getReactionsQueue(state)
  48. };
  49. };
  50. export default connect(mapStateToProps)(DialogContainer);