您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

MuteButton.js 1.9KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /* @flow */
  2. import React from 'react';
  3. import { translate } from '../../../base/i18n';
  4. import { IconMicrophoneEmptySlash } from '../../../base/icons';
  5. import { connect } from '../../../base/redux';
  6. import ContextMenuItem from '../../../base/ui/components/web/ContextMenuItem';
  7. import AbstractMuteButton, {
  8. type Props,
  9. _mapStateToProps
  10. } from '../AbstractMuteButton';
  11. /**
  12. * Implements a React {@link Component} which displays a button for audio muting
  13. * a participant in the conference.
  14. *
  15. * NOTE: At the time of writing this is a button that doesn't use the
  16. * {@code AbstractButton} base component, but is inherited from the same
  17. * super class ({@code AbstractMuteButton} that extends {@code AbstractButton})
  18. * for the sake of code sharing between web and mobile. Once web uses the
  19. * {@code AbstractButton} base component, this can be fully removed.
  20. */
  21. class MuteButton extends AbstractMuteButton {
  22. /**
  23. * Instantiates a new {@code Component}.
  24. *
  25. * @inheritdoc
  26. */
  27. constructor(props: Props) {
  28. super(props);
  29. this._handleClick = this._handleClick.bind(this);
  30. }
  31. /**
  32. * Implements React's {@link Component#render()}.
  33. *
  34. * @inheritdoc
  35. * @returns {ReactElement}
  36. */
  37. render() {
  38. const { _audioTrackMuted, t } = this.props;
  39. if (_audioTrackMuted) {
  40. return null;
  41. }
  42. return (
  43. <ContextMenuItem
  44. accessibilityLabel = { t('dialog.muteParticipantButton') }
  45. className = 'mutelink'
  46. icon = { IconMicrophoneEmptySlash }
  47. // eslint-disable-next-line react/jsx-handler-names
  48. onClick = { this._handleClick }
  49. text = { t('dialog.muteParticipantButton') } />
  50. );
  51. }
  52. _handleClick: () => void;
  53. }
  54. export default translate(connect(_mapStateToProps)(MuteButton));