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.

RaiseHandButton.js 1.7KB

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