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.5KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. import { translate } from '../../../base/i18n';
  2. import { IconRaiseHand } 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. toggledAccessibilityLabel = 'toolbar.accessibilityLabel.lowerHand';
  21. icon = IconRaiseHand;
  22. label = 'toolbar.raiseHand';
  23. toggledLabel = 'toolbar.lowerYourHand';
  24. tooltip = 'toolbar.raiseHand';
  25. toggledTooltip = 'toolbar.lowerYourHand';
  26. /**
  27. * Indicates whether this button is in toggled state or not.
  28. *
  29. * @override
  30. * @protected
  31. * @returns {boolean}
  32. */
  33. _isToggled() {
  34. return this.props.raisedHand;
  35. }
  36. }
  37. /**
  38. * Function that maps parts of Redux state tree into component props.
  39. *
  40. * @param {Object} state - Redux state.
  41. * @returns {Object}
  42. */
  43. const mapStateToProps = state => {
  44. const localParticipant = getLocalParticipant(state);
  45. return {
  46. raisedHand: hasRaisedHand(localParticipant)
  47. };
  48. };
  49. export default translate(connect(mapStateToProps)(RaiseHandButton));