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

MuteEveryoneElseButton.tsx 1.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. import React, { useCallback } from 'react';
  2. import { useTranslation } from 'react-i18next';
  3. import { useDispatch } from 'react-redux';
  4. import { createToolbarEvent } from '../../../analytics/AnalyticsEvents';
  5. import { sendAnalytics } from '../../../analytics/functions';
  6. import { openDialog } from '../../../base/dialog/actions';
  7. import { IconMicSlash } from '../../../base/icons/svg';
  8. import ContextMenuItem from '../../../base/ui/components/web/ContextMenuItem';
  9. import { NOTIFY_CLICK_MODE } from '../../../toolbox/constants';
  10. import { IButtonProps } from '../../types';
  11. import MuteEveryoneDialog from './MuteEveryoneDialog';
  12. /**
  13. * Implements a React {@link Component} which displays a button for audio muting
  14. * every participant in the conference except the one with the given
  15. * participantID.
  16. *
  17. * @returns {JSX.Element}
  18. */
  19. const MuteEveryoneElseButton = ({
  20. notifyClick,
  21. notifyMode,
  22. participantID
  23. }: IButtonProps): JSX.Element => {
  24. const { t } = useTranslation();
  25. const dispatch = useDispatch();
  26. const handleClick = useCallback(() => {
  27. notifyClick?.();
  28. if (notifyMode === NOTIFY_CLICK_MODE.PREVENT_AND_NOTIFY) {
  29. return;
  30. }
  31. sendAnalytics(createToolbarEvent('mute.everyoneelse.pressed'));
  32. dispatch(openDialog(MuteEveryoneDialog, { exclude: [ participantID ] }));
  33. }, [ dispatch, notifyMode, notifyClick, participantID, sendAnalytics ]);
  34. return (
  35. <ContextMenuItem
  36. accessibilityLabel = { t('toolbar.accessibilityLabel.muteEveryoneElse') }
  37. icon = { IconMicSlash }
  38. onClick = { handleClick }
  39. text = { t('videothumbnail.domuteOthers') } />
  40. );
  41. };
  42. export default MuteEveryoneElseButton;