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.

SendToBreakoutRoom.js 2.0KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. // @flow
  2. import { createBreakoutRoomsEvent, sendAnalytics } from '../../../analytics';
  3. import { translate } from '../../../base/i18n';
  4. import { IconRingGroup } from '../../../base/icons';
  5. import { isLocalParticipantModerator } from '../../../base/participants';
  6. import { connect } from '../../../base/redux';
  7. import { AbstractButton, type AbstractButtonProps } from '../../../base/toolbox/components';
  8. import { sendParticipantToRoom } from '../../../breakout-rooms/actions';
  9. export type Props = AbstractButtonProps & {
  10. /**
  11. * The redux {@code dispatch} function.
  12. */
  13. dispatch: Function,
  14. /**
  15. * ID of the participant to send to breakout room.
  16. */
  17. participantID: string,
  18. /**
  19. * Room to send participant to.
  20. */
  21. room: Object,
  22. /**
  23. * Translation function.
  24. */
  25. t: Function
  26. };
  27. /**
  28. * An abstract remote video menu button which sends the remote participant to a breakout room.
  29. */
  30. class SendToBreakoutRoom extends AbstractButton<Props, *> {
  31. accessibilityLabel = 'breakoutRooms.actions.sendToBreakoutRoom';
  32. icon = IconRingGroup;
  33. /**
  34. * Gets the current label.
  35. *
  36. * @returns {string}
  37. */
  38. _getLabel() {
  39. const { t, room } = this.props;
  40. return room.name || t('breakoutRooms.mainRoom');
  41. }
  42. /**
  43. * Handles clicking / pressing the button, and asks the participant to unmute.
  44. *
  45. * @private
  46. * @returns {void}
  47. */
  48. _handleClick() {
  49. const { dispatch, participantID, room } = this.props;
  50. sendAnalytics(createBreakoutRoomsEvent('send.participant.to.room'));
  51. dispatch(sendParticipantToRoom(participantID, room.id));
  52. }
  53. }
  54. /**
  55. * Maps part of the Redux state to the props of this component.
  56. *
  57. * @param {Object} state - The Redux state.
  58. * @param {Object} ownProps - Properties of component.
  59. * @returns {Props}
  60. */
  61. function mapStateToProps(state) {
  62. return {
  63. visible: isLocalParticipantModerator(state)
  64. };
  65. }
  66. export default translate(connect(mapStateToProps)(SendToBreakoutRoom));