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.

MeetingParticipantContextMenu.js 3.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. // @flow
  2. import React, { Component } from 'react';
  3. import { translate } from '../../../base/i18n';
  4. import {
  5. getLocalParticipant,
  6. getParticipantByIdOrUndefined
  7. } from '../../../base/participants';
  8. import { connect } from '../../../base/redux';
  9. import ParticipantContextMenu from '../../../video-menu/components/web/ParticipantContextMenu';
  10. type Props = {
  11. /**
  12. * Shared video local participant owner.
  13. */
  14. _localVideoOwner: boolean,
  15. /**
  16. * Participant reference.
  17. */
  18. _participant: Object,
  19. /**
  20. * Closes a drawer if open.
  21. */
  22. closeDrawer: Function,
  23. /**
  24. * The dispatch function from redux.
  25. */
  26. dispatch: Function,
  27. /**
  28. * The participant for which the drawer is open.
  29. * It contains the displayName & participantID.
  30. */
  31. drawerParticipant: Object,
  32. /**
  33. * Target elements against which positioning calculations are made.
  34. */
  35. offsetTarget?: HTMLElement,
  36. /**
  37. * Callback for the mouse entering the component.
  38. */
  39. onEnter: Function,
  40. /**
  41. * Callback for the mouse leaving the component.
  42. */
  43. onLeave: Function,
  44. /**
  45. * Callback for making a selection in the menu.
  46. */
  47. onSelect: Function,
  48. /**
  49. * The ID of the participant.
  50. */
  51. participantID: string
  52. };
  53. /**
  54. * Implements the MeetingParticipantContextMenu component.
  55. */
  56. class MeetingParticipantContextMenu extends Component<Props> {
  57. /**
  58. * Implements React's {@link Component#render()}.
  59. *
  60. * @inheritdoc
  61. * @returns {ReactElement}
  62. */
  63. render() {
  64. const {
  65. _localVideoOwner,
  66. _participant,
  67. closeDrawer,
  68. drawerParticipant,
  69. offsetTarget,
  70. onEnter,
  71. onLeave,
  72. onSelect
  73. } = this.props;
  74. if (!_participant) {
  75. return null;
  76. }
  77. return (
  78. <ParticipantContextMenu
  79. closeDrawer = { closeDrawer }
  80. drawerParticipant = { drawerParticipant }
  81. localVideoOwner = { _localVideoOwner }
  82. offsetTarget = { offsetTarget }
  83. onEnter = { onEnter }
  84. onLeave = { onLeave }
  85. onSelect = { onSelect }
  86. participant = { _participant }
  87. thumbnailMenu = { false } />
  88. );
  89. }
  90. }
  91. /**
  92. * Maps (parts of) the redux state to the associated props for this component.
  93. *
  94. * @param {Object} state - The Redux state.
  95. * @param {Object} ownProps - The own props of the component.
  96. * @private
  97. * @returns {Props}
  98. */
  99. function _mapStateToProps(state, ownProps): Object {
  100. const { participantID, overflowDrawer, drawerParticipant } = ownProps;
  101. const { ownerId } = state['features/shared-video'];
  102. const localParticipantId = getLocalParticipant(state).id;
  103. const participant = getParticipantByIdOrUndefined(state,
  104. overflowDrawer ? drawerParticipant?.participantID : participantID);
  105. return {
  106. _localVideoOwner: Boolean(ownerId === localParticipantId),
  107. _participant: participant
  108. };
  109. }
  110. export default translate(connect(_mapStateToProps)(MeetingParticipantContextMenu));