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.

InviteMore.js 2.4KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. // @flow
  2. import React from 'react';
  3. import { translate } from '../../../base/i18n';
  4. import { Icon, IconInviteMore } from '../../../base/icons';
  5. import { getParticipantCount } from '../../../base/participants';
  6. import { connect } from '../../../base/redux';
  7. import { beginAddPeople } from '../../../invite';
  8. import { isToolboxVisible } from '../../../toolbox';
  9. type Props = {
  10. /**
  11. * Whether tile view is enabled.
  12. */
  13. _tileViewEnabled: Boolean,
  14. /**
  15. * Whether to show the option to invite more people
  16. * instead of the subject.
  17. */
  18. _visible: boolean,
  19. /**
  20. * Handler to open the invite dialog.
  21. */
  22. onClick: Function,
  23. /**
  24. * Invoked to obtain translated strings.
  25. */
  26. t: Function
  27. }
  28. /**
  29. * Represents a replacement for the subject, prompting the
  30. * sole participant to invite more participants.
  31. *
  32. * @param {Object} props - The props of the component.
  33. * @returns {React$Element<any>}
  34. */
  35. function InviteMore({
  36. _tileViewEnabled,
  37. _visible,
  38. onClick,
  39. t
  40. }: Props) {
  41. return (
  42. _visible
  43. ? <div className = { `invite-more-container${_tileViewEnabled ? ' elevated' : ''}` }>
  44. <div className = 'invite-more-header'>
  45. {t('addPeople.inviteMoreHeader')}
  46. </div>
  47. <div
  48. className = 'invite-more-button'
  49. onClick = { onClick }>
  50. <Icon src = { IconInviteMore } />
  51. <div className = 'invite-more-button-text'>
  52. {t('addPeople.inviteMorePrompt')}
  53. </div>
  54. </div>
  55. </div> : null
  56. );
  57. }
  58. /**
  59. * Maps (parts of) the Redux state to the associated
  60. * {@code Subject}'s props.
  61. *
  62. * @param {Object} state - The Redux state.
  63. * @private
  64. * @returns {Props}
  65. */
  66. function mapStateToProps(state) {
  67. const participantCount = getParticipantCount(state);
  68. return {
  69. _tileViewEnabled: state['features/video-layout'].tileViewEnabled,
  70. _visible: isToolboxVisible(state) && participantCount === 1
  71. };
  72. }
  73. /**
  74. * Maps dispatching of some action to React component props.
  75. *
  76. * @param {Function} dispatch - Redux action dispatcher.
  77. * @returns {Props}
  78. */
  79. const mapDispatchToProps = {
  80. onClick: () => beginAddPeople()
  81. };
  82. export default translate(connect(mapStateToProps, mapDispatchToProps)(InviteMore));