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

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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 { ActionTrigger, MediaState } from '../constants';
  7. import { ParticipantItem } from './ParticipantItem';
  8. import { ParticipantActionEllipsis } from './styled';
  9. type Props = {
  10. /**
  11. * Is this item highlighted
  12. */
  13. isHighlighted: boolean,
  14. /**
  15. * Callback for the activation of this item's context menu
  16. */
  17. onContextMenu: Function,
  18. /**
  19. * Callback for the mouse leaving this item
  20. */
  21. onLeave: Function,
  22. /**
  23. * Participant reference
  24. */
  25. participant: Object
  26. };
  27. export const MeetingParticipantItem = ({
  28. isHighlighted,
  29. onContextMenu,
  30. onLeave,
  31. participant
  32. }: Props) => {
  33. const { t } = useTranslation();
  34. const isAudioMuted = useSelector(getIsParticipantAudioMuted(participant));
  35. const isVideoMuted = useSelector(getIsParticipantVideoMuted(participant));
  36. return (
  37. <ParticipantItem
  38. actionsTrigger = { ActionTrigger.Hover }
  39. audioMuteState = { isAudioMuted ? MediaState.Muted : MediaState.Unmuted }
  40. isHighlighted = { isHighlighted }
  41. onLeave = { onLeave }
  42. participant = { participant }
  43. videoMuteState = { isVideoMuted ? MediaState.Muted : MediaState.Unmuted }>
  44. <ParticipantActionEllipsis
  45. aria-label = { t('MeetingParticipantItem.ParticipantActionEllipsis.options') }
  46. onClick = { onContextMenu } />
  47. </ParticipantItem>
  48. );
  49. };