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.

LowerHandButton.tsx 2.0KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. import { connect } from 'react-redux';
  2. import { IReduxState } from '../../../app/types';
  3. import { getCurrentConference } from '../../../base/conference/functions';
  4. import { IJitsiConference } from '../../../base/conference/reducer';
  5. import { translate } from '../../../base/i18n/functions';
  6. import { IconRaiseHand } from '../../../base/icons/svg';
  7. import AbstractButton, { IProps as AbstractButtonProps } from '../../../base/toolbox/components/AbstractButton';
  8. import { LOWER_HAND_MESSAGE } from '../../../base/tracks/constants';
  9. interface IProps extends AbstractButtonProps {
  10. /**
  11. * The current conference.
  12. */
  13. _conference: IJitsiConference | undefined;
  14. /**
  15. * The ID of the participant object that this button is supposed to
  16. * ask to lower the hand.
  17. */
  18. participantId: String | undefined;
  19. }
  20. /**
  21. * Implements a React {@link Component} which displays a button for lowering certain
  22. * participant raised hands.
  23. *
  24. * @returns {JSX.Element}
  25. */
  26. class LowerHandButton extends AbstractButton<IProps> {
  27. icon = IconRaiseHand;
  28. accessibilityLabel = 'participantsPane.actions.lowerHand';
  29. label = 'participantsPane.actions.lowerHand';
  30. /**
  31. * Handles clicking / pressing the button, and asks the participant to lower hand.
  32. *
  33. * @private
  34. * @returns {void}
  35. */
  36. _handleClick() {
  37. const { participantId, _conference } = this.props;
  38. _conference?.sendEndpointMessage(
  39. participantId,
  40. {
  41. name: LOWER_HAND_MESSAGE
  42. }
  43. );
  44. }
  45. }
  46. /**
  47. * Maps part of the Redux state to the props of this component.
  48. *
  49. * @param {Object} state - The Redux state.
  50. * @param {Object} ownProps - Properties of component.
  51. * @returns {IProps}
  52. */
  53. function mapStateToProps(state: IReduxState, ownProps: any) {
  54. const { participantID } = ownProps;
  55. const currentConference = getCurrentConference(state);
  56. return {
  57. _conference: currentConference,
  58. participantId: participantID
  59. };
  60. }
  61. export default translate(connect(mapStateToProps)(LowerHandButton));