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.ts 2.1KB

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