You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

AskToUnmuteButton.js 994B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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 { QuickActionButton } from './styled';
  7. type Props = {
  8. /**
  9. * Participant id.
  10. */
  11. id: string
  12. }
  13. /**
  14. * Component used to display the `ask to unmute` button.
  15. *
  16. * @param {Object} participant - Participant reference.
  17. * @returns {React$Element<'button'>}
  18. */
  19. export default function({ id }: Props) {
  20. const dispatch = useDispatch();
  21. const { t } = useTranslation();
  22. const askToUnmute = useCallback(() => {
  23. dispatch(approveParticipant(id));
  24. }, [ dispatch, id ]);
  25. return (
  26. <QuickActionButton
  27. onClick = { askToUnmute }
  28. primary = { true }
  29. theme = {{
  30. panePadding: 16
  31. }}>
  32. {t('participantsPane.actions.askUnmute')}
  33. </QuickActionButton>
  34. );
  35. }