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.

ParticipantQuickAction.js 1.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. // @flow
  2. import React from 'react';
  3. import { QUICK_ACTION_BUTTON } from '../constants';
  4. import AskToUnmuteButton from './AskToUnmuteButton';
  5. import { QuickActionButton } from './styled';
  6. type Props = {
  7. /**
  8. * The translated "ask unmute" text.
  9. */
  10. askUnmuteText: string,
  11. /**
  12. * The type of button to be displayed.
  13. */
  14. buttonType: string,
  15. /**
  16. * Callback used to open a confirmation dialog for audio muting.
  17. */
  18. muteAudio: Function,
  19. muteParticipantButtonText: string,
  20. /**
  21. * The ID of the participant.
  22. */
  23. participantID: string,
  24. }
  25. /**
  26. * Component used to display mute/ask to unmute button.
  27. *
  28. * @param {Props} props - The props of the component.
  29. * @returns {React$Element<'button'>}
  30. */
  31. export default function ParticipantQuickAction({
  32. askUnmuteText,
  33. buttonType,
  34. muteAudio,
  35. muteParticipantButtonText,
  36. participantID
  37. }: Props) {
  38. switch (buttonType) {
  39. case QUICK_ACTION_BUTTON.MUTE: {
  40. return (
  41. <QuickActionButton
  42. onClick = { muteAudio(participantID) }
  43. primary = { true }>
  44. { muteParticipantButtonText }
  45. </QuickActionButton>
  46. );
  47. }
  48. case QUICK_ACTION_BUTTON.ASK_TO_UNMUTE: {
  49. return (
  50. <AskToUnmuteButton
  51. askUnmuteText = { askUnmuteText }
  52. id = { participantID } />
  53. );
  54. }
  55. default: {
  56. return null;
  57. }
  58. }
  59. }