Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

MuteButton.js 2.0KB

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