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 1.7KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. import React, { useCallback } from 'react';
  2. import { useTranslation } from 'react-i18next';
  3. import { useDispatch, useSelector } from 'react-redux';
  4. import { getCurrentConference } from '../../../base/conference/functions';
  5. import { IconRaiseHand } from '../../../base/icons/svg';
  6. import { raiseHand } from '../../../base/participants/actions';
  7. import { LOWER_HAND_MESSAGE } from '../../../base/tracks/constants';
  8. import ContextMenuItem from '../../../base/ui/components/web/ContextMenuItem';
  9. interface IProps {
  10. /**
  11. * The ID of the participant that's linked to the button.
  12. */
  13. participantID?: String;
  14. }
  15. /**
  16. * Implements a React {@link Component} which displays a button for notifying certain
  17. * participant who raised hand to lower hand.
  18. *
  19. * @returns {JSX.Element}
  20. */
  21. const LowerHandButton = ({
  22. participantID = ''
  23. }: IProps): JSX.Element => {
  24. const { t } = useTranslation();
  25. const dispatch = useDispatch();
  26. const currentConference = useSelector(getCurrentConference);
  27. const accessibilityText = participantID
  28. ? t('participantsPane.actions.lowerHand')
  29. : t('participantsPane.actions.lowerAllHands');
  30. const handleClick = useCallback(() => {
  31. if (!participantID) {
  32. dispatch(raiseHand(false));
  33. }
  34. currentConference?.sendEndpointMessage(
  35. participantID,
  36. {
  37. name: LOWER_HAND_MESSAGE
  38. }
  39. );
  40. }, [ participantID ]);
  41. return (
  42. <ContextMenuItem
  43. accessibilityLabel = { accessibilityText }
  44. icon = { IconRaiseHand }
  45. onClick = { handleClick }
  46. text = { accessibilityText } />
  47. );
  48. };
  49. export default LowerHandButton;