Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

RaiseHandButton.js 1.7KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. // @flow
  2. import { translate } from '../../../base/i18n';
  3. import { IconRaisedHand } from '../../../base/icons';
  4. import { getLocalParticipant, hasRaisedHand } from '../../../base/participants';
  5. import { connect } from '../../../base/redux';
  6. import { AbstractButton, type AbstractButtonProps } from '../../../base/toolbox/components';
  7. /**
  8. * The type of the React {@code Component} props of {@link RaiseHandButton}.
  9. */
  10. type Props = AbstractButtonProps & {
  11. /**
  12. * Whether or not the hand is raised.
  13. */
  14. raisedHand: boolean,
  15. };
  16. /**
  17. * Implementation of a button for raising hand.
  18. */
  19. class RaiseHandButton extends AbstractButton<Props, *> {
  20. accessibilityLabel = 'toolbar.accessibilityLabel.raiseHand';
  21. icon = IconRaisedHand;
  22. label = 'toolbar.raiseHand';
  23. toggledLabel = 'toolbar.raiseHand';
  24. /**
  25. * Retrieves tooltip dynamically.
  26. */
  27. get tooltip() {
  28. return 'toolbar.raiseHand';
  29. }
  30. /**
  31. * Required by linter due to AbstractButton overwritten prop being writable.
  32. *
  33. * @param {string} _value - The value.
  34. */
  35. set tooltip(_value) {
  36. // Unused.
  37. }
  38. /**
  39. * Indicates whether this button is in toggled state or not.
  40. *
  41. * @override
  42. * @protected
  43. * @returns {boolean}
  44. */
  45. _isToggled() {
  46. return this.props.raisedHand;
  47. }
  48. }
  49. /**
  50. * Function that maps parts of Redux state tree into component props.
  51. *
  52. * @param {Object} state - Redux state.
  53. * @returns {Object}
  54. */
  55. const mapStateToProps = state => {
  56. const localParticipant = getLocalParticipant(state);
  57. return {
  58. raisedHand: hasRaisedHand(localParticipant)
  59. };
  60. };
  61. export default translate(connect(mapStateToProps)(RaiseHandButton));