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

VerifyParticipantButton.tsx 1.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. import React, { useCallback } from 'react';
  2. import { useTranslation } from 'react-i18next';
  3. import { useDispatch } from 'react-redux';
  4. import { IconCheck } from '../../../base/icons/svg';
  5. import ContextMenuItem from '../../../base/ui/components/web/ContextMenuItem';
  6. import { startVerification } from '../../../e2ee/actions';
  7. import { NOTIFY_CLICK_MODE } from '../../../toolbox/constants';
  8. import { IButtonProps } from '../../types';
  9. /**
  10. * Implements a React {@link Component} which displays a button that
  11. * verifies the participant.
  12. *
  13. * @returns {JSX.Element}
  14. */
  15. const VerifyParticipantButton = ({
  16. notifyClick,
  17. notifyMode,
  18. participantID
  19. }: IButtonProps): JSX.Element => {
  20. const { t } = useTranslation();
  21. const dispatch = useDispatch();
  22. const _handleClick = useCallback(() => {
  23. notifyClick?.();
  24. if (notifyMode === NOTIFY_CLICK_MODE.PREVENT_AND_NOTIFY) {
  25. return;
  26. }
  27. dispatch(startVerification(participantID));
  28. }, [ dispatch, notifyClick, notifyMode, participantID ]);
  29. return (
  30. <ContextMenuItem
  31. accessibilityLabel = { t('videothumbnail.verify') }
  32. className = 'verifylink'
  33. icon = { IconCheck }
  34. id = { `verifylink_${participantID}` }
  35. // eslint-disable-next-line react/jsx-handler-names
  36. onClick = { _handleClick }
  37. text = { t('videothumbnail.verify') } />
  38. );
  39. };
  40. export default VerifyParticipantButton;