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

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. // @flow
  2. import React, { useCallback } from 'react';
  3. import { useDispatch } from 'react-redux';
  4. import { approveParticipant } from '../../av-moderation/actions';
  5. import { QuickActionButton } from './web/styled';
  6. type Props = {
  7. /**
  8. * The translated ask unmute text.
  9. */
  10. askUnmuteText: string,
  11. /**
  12. * Participant participantID.
  13. */
  14. participantID: string,
  15. }
  16. /**
  17. * Component used to display the `ask to unmute` button.
  18. *
  19. * @param {Object} participant - Participant reference.
  20. * @returns {React$Element<'button'>}
  21. */
  22. export default function AskToUnmuteButton({ askUnmuteText, participantID }: Props) {
  23. const dispatch = useDispatch();
  24. const askToUnmute = useCallback(() => {
  25. dispatch(approveParticipant(participantID));
  26. }, [ dispatch, participantID ]);
  27. return (
  28. <QuickActionButton
  29. aria-label = { `unmute-${participantID}` }
  30. onClick = { askToUnmute }
  31. primary = { true }
  32. theme = {{
  33. panePadding: 16
  34. }}>
  35. { askUnmuteText }
  36. </QuickActionButton>
  37. );
  38. }