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

AskToUnmuteButton.js 1.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. // @flow
  2. import React, { useCallback } from 'react';
  3. import { useTranslation } from 'react-i18next';
  4. import { useDispatch } from 'react-redux';
  5. import { approveParticipant } from '../../../av-moderation/actions';
  6. import { IconMic } from '../../../base/icons';
  7. import ContextMenuItem from '../../../base/ui/components/web/ContextMenuItem';
  8. type Props = {
  9. /**
  10. * Whether or not the participant is audio force muted.
  11. */
  12. isAudioForceMuted: boolean,
  13. /**
  14. * Whether or not the participant is video force muted.
  15. */
  16. isVideoForceMuted: boolean,
  17. /**
  18. * The ID for the participant on which the button will act.
  19. */
  20. participantID: string
  21. }
  22. const AskToUnmuteButton = ({ isAudioForceMuted, isVideoForceMuted, participantID }: Props) => {
  23. const dispatch = useDispatch();
  24. const { t } = useTranslation();
  25. const _onClick = useCallback(() => {
  26. dispatch(approveParticipant(participantID));
  27. }, [ participantID ]);
  28. const text = isAudioForceMuted || !isVideoForceMuted
  29. ? t('participantsPane.actions.askUnmute')
  30. : t('participantsPane.actions.allowVideo');
  31. return (
  32. <ContextMenuItem
  33. accessibilityLabel = { text }
  34. icon = { IconMic }
  35. onClick = { _onClick }
  36. text = { text } />
  37. );
  38. };
  39. export default AskToUnmuteButton;