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.

MuteEveryoneElseButton.js 2.0KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. // @flow
  2. import React from 'react';
  3. import { createToolbarEvent, sendAnalytics } from '../../../analytics';
  4. import { openDialog } from '../../../base/dialog';
  5. import { translate } from '../../../base/i18n';
  6. import { IconMicDisabled } from '../../../base/icons';
  7. import { connect } from '../../../base/redux';
  8. import AbstractMuteButton, {
  9. _mapStateToProps,
  10. type Props
  11. } from '../AbstractMuteButton';
  12. import MuteEveryoneDialog from './MuteEveryoneDialog';
  13. import RemoteVideoMenuButton from './RemoteVideoMenuButton';
  14. /**
  15. * Implements a React {@link Component} which displays a button for audio muting
  16. * every participant in the conference except the one with the given
  17. * participantID
  18. */
  19. class MuteEveryoneElseButton extends AbstractMuteButton {
  20. /**
  21. * Instantiates a new {@code MuteEveryoneElseButton}.
  22. *
  23. * @inheritdoc
  24. */
  25. constructor(props: Props) {
  26. super(props);
  27. this._handleClick = this._handleClick.bind(this);
  28. }
  29. /**
  30. * Implements React's {@link Component#render()}.
  31. *
  32. * @inheritdoc
  33. * @returns {ReactElement}
  34. */
  35. render() {
  36. const { participantID, t } = this.props;
  37. return (
  38. <RemoteVideoMenuButton
  39. buttonText = { t('videothumbnail.domuteOthers') }
  40. displayClass = { 'mutelink' }
  41. icon = { IconMicDisabled }
  42. id = { `mutelink_${participantID}` }
  43. // eslint-disable-next-line react/jsx-handler-names
  44. onClick = { this._handleClick } />
  45. );
  46. }
  47. _handleClick: () => void;
  48. /**
  49. * Handles clicking / pressing the button, and opens a confirmation dialog.
  50. *
  51. * @private
  52. * @returns {void}
  53. */
  54. _handleClick() {
  55. const { dispatch, participantID } = this.props;
  56. sendAnalytics(createToolbarEvent('mute.everyoneelse.pressed'));
  57. dispatch(openDialog(MuteEveryoneDialog, { exclude: [ participantID ] }));
  58. }
  59. }
  60. export default translate(connect(_mapStateToProps)(MuteEveryoneElseButton));