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.

MeetingParticipantItem.js 2.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. // @flow
  2. import React from 'react';
  3. import { useTranslation } from 'react-i18next';
  4. import { useSelector } from 'react-redux';
  5. import { getIsParticipantAudioMuted, getIsParticipantVideoMuted } from '../../base/tracks';
  6. import { ACTION_TRIGGER, MEDIA_STATE } from '../constants';
  7. import { getParticipantAudioMediaState } from '../functions';
  8. import { ParticipantItem } from './ParticipantItem';
  9. import ParticipantQuickAction from './ParticipantQuickAction';
  10. import { ParticipantActionEllipsis } from './styled';
  11. type Props = {
  12. /**
  13. * Is this item highlighted
  14. */
  15. isHighlighted: boolean,
  16. /**
  17. * Callback used to open a confirmation dialog for audio muting.
  18. */
  19. muteAudio: Function,
  20. /**
  21. * Callback for the activation of this item's context menu
  22. */
  23. onContextMenu: Function,
  24. /**
  25. * Callback for the mouse leaving this item
  26. */
  27. onLeave: Function,
  28. /**
  29. * Participant reference
  30. */
  31. participant: Object
  32. };
  33. export const MeetingParticipantItem = ({
  34. isHighlighted,
  35. onContextMenu,
  36. onLeave,
  37. muteAudio,
  38. participant
  39. }: Props) => {
  40. const { t } = useTranslation();
  41. const isAudioMuted = useSelector(getIsParticipantAudioMuted(participant));
  42. const isVideoMuted = useSelector(getIsParticipantVideoMuted(participant));
  43. const audioMediaState = useSelector(getParticipantAudioMediaState(participant, isAudioMuted));
  44. return (
  45. <ParticipantItem
  46. actionsTrigger = { ACTION_TRIGGER.HOVER }
  47. audioMediaState = { audioMediaState }
  48. isHighlighted = { isHighlighted }
  49. onLeave = { onLeave }
  50. participant = { participant }
  51. videoMuteState = { isVideoMuted ? MEDIA_STATE.MUTED : MEDIA_STATE.UNMUTED }>
  52. <ParticipantQuickAction
  53. isAudioMuted = { isAudioMuted }
  54. muteAudio = { muteAudio }
  55. participant = { participant } />
  56. <ParticipantActionEllipsis
  57. aria-label = { t('MeetingParticipantItem.ParticipantActionEllipsis.options') }
  58. onClick = { onContextMenu } />
  59. </ParticipantItem>
  60. );
  61. };