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

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