2021-04-21 13:48:05 +00:00
|
|
|
// @flow
|
2021-07-09 12:36:19 +00:00
|
|
|
import React, { Component } from 'react';
|
2021-04-21 13:48:05 +00:00
|
|
|
|
2021-07-12 15:14:38 +00:00
|
|
|
import { translate } from '../../../base/i18n';
|
2021-07-09 12:36:19 +00:00
|
|
|
import {
|
2021-08-04 08:51:05 +00:00
|
|
|
getLocalParticipant,
|
2021-12-15 13:18:41 +00:00
|
|
|
getParticipantByIdOrUndefined
|
2021-07-12 15:14:38 +00:00
|
|
|
} from '../../../base/participants';
|
|
|
|
import { connect } from '../../../base/redux';
|
2022-09-30 14:50:45 +00:00
|
|
|
import FakeParticipantContextMenu from '../../../video-menu/components/web/FakeParticipantContextMenu';
|
2021-12-15 13:18:41 +00:00
|
|
|
import ParticipantContextMenu from '../../../video-menu/components/web/ParticipantContextMenu';
|
2021-04-21 13:48:05 +00:00
|
|
|
|
|
|
|
type Props = {
|
|
|
|
|
2021-08-04 08:51:05 +00:00
|
|
|
/**
|
|
|
|
* Shared video local participant owner.
|
|
|
|
*/
|
|
|
|
_localVideoOwner: boolean,
|
|
|
|
|
2021-07-09 12:36:19 +00:00
|
|
|
/**
|
2021-11-04 21:10:43 +00:00
|
|
|
* Participant reference.
|
2021-07-09 12:36:19 +00:00
|
|
|
*/
|
|
|
|
_participant: Object,
|
|
|
|
|
2021-09-10 11:05:16 +00:00
|
|
|
/**
|
|
|
|
* Closes a drawer if open.
|
|
|
|
*/
|
|
|
|
closeDrawer: Function,
|
|
|
|
|
2021-07-09 12:36:19 +00:00
|
|
|
/**
|
|
|
|
* The dispatch function from redux.
|
|
|
|
*/
|
|
|
|
dispatch: Function,
|
|
|
|
|
2021-09-10 11:05:16 +00:00
|
|
|
/**
|
|
|
|
* The participant for which the drawer is open.
|
|
|
|
* It contains the displayName & participantID.
|
|
|
|
*/
|
|
|
|
drawerParticipant: Object,
|
|
|
|
|
2021-04-21 13:48:05 +00:00
|
|
|
/**
|
2021-11-04 21:10:43 +00:00
|
|
|
* Target elements against which positioning calculations are made.
|
2021-04-21 13:48:05 +00:00
|
|
|
*/
|
2021-09-14 15:31:30 +00:00
|
|
|
offsetTarget?: HTMLElement,
|
2021-04-21 13:48:05 +00:00
|
|
|
|
|
|
|
/**
|
2021-11-04 21:10:43 +00:00
|
|
|
* Callback for the mouse entering the component.
|
2021-04-21 13:48:05 +00:00
|
|
|
*/
|
|
|
|
onEnter: Function,
|
|
|
|
|
|
|
|
/**
|
2021-11-04 21:10:43 +00:00
|
|
|
* Callback for the mouse leaving the component.
|
2021-04-21 13:48:05 +00:00
|
|
|
*/
|
|
|
|
onLeave: Function,
|
|
|
|
|
|
|
|
/**
|
2021-11-04 21:10:43 +00:00
|
|
|
* Callback for making a selection in the menu.
|
2021-04-21 13:48:05 +00:00
|
|
|
*/
|
|
|
|
onSelect: Function,
|
|
|
|
|
|
|
|
/**
|
2021-07-09 12:36:19 +00:00
|
|
|
* The ID of the participant.
|
|
|
|
*/
|
2021-12-15 13:18:41 +00:00
|
|
|
participantID: string
|
2021-09-14 15:31:30 +00:00
|
|
|
};
|
|
|
|
|
2021-07-09 12:36:19 +00:00
|
|
|
/**
|
|
|
|
* Implements the MeetingParticipantContextMenu component.
|
|
|
|
*/
|
2021-10-22 13:23:52 +00:00
|
|
|
class MeetingParticipantContextMenu extends Component<Props> {
|
2021-07-09 12:36:19 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Implements React's {@link Component#render()}.
|
|
|
|
*
|
|
|
|
* @inheritdoc
|
|
|
|
* @returns {ReactElement}
|
|
|
|
*/
|
|
|
|
render() {
|
|
|
|
const {
|
2021-08-04 08:51:05 +00:00
|
|
|
_localVideoOwner,
|
2021-07-09 12:36:19 +00:00
|
|
|
_participant,
|
2021-09-10 11:05:16 +00:00
|
|
|
closeDrawer,
|
|
|
|
drawerParticipant,
|
2021-10-22 13:23:52 +00:00
|
|
|
offsetTarget,
|
2021-07-09 12:36:19 +00:00
|
|
|
onEnter,
|
|
|
|
onLeave,
|
2021-12-15 13:18:41 +00:00
|
|
|
onSelect
|
2021-07-09 12:36:19 +00:00
|
|
|
} = this.props;
|
2021-04-21 13:48:05 +00:00
|
|
|
|
2021-07-09 12:36:19 +00:00
|
|
|
if (!_participant) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2022-09-30 14:50:45 +00:00
|
|
|
const props = {
|
|
|
|
closeDrawer,
|
|
|
|
drawerParticipant,
|
|
|
|
offsetTarget,
|
|
|
|
onEnter,
|
|
|
|
onLeave,
|
|
|
|
onSelect,
|
|
|
|
participant: _participant,
|
|
|
|
thumbnailMenu: false
|
|
|
|
};
|
|
|
|
|
|
|
|
if (_participant?.isFakeParticipant) {
|
|
|
|
return (
|
|
|
|
<FakeParticipantContextMenu
|
|
|
|
{ ...props }
|
|
|
|
localVideoOwner = { _localVideoOwner } />
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
return <ParticipantContextMenu { ...props } />;
|
2021-04-21 13:48:05 +00:00
|
|
|
}
|
2021-07-09 12:36:19 +00:00
|
|
|
}
|
2021-04-21 13:48:05 +00:00
|
|
|
|
2021-07-09 12:36:19 +00:00
|
|
|
/**
|
|
|
|
* Maps (parts of) the redux state to the associated props for this component.
|
|
|
|
*
|
|
|
|
* @param {Object} state - The Redux state.
|
|
|
|
* @param {Object} ownProps - The own props of the component.
|
|
|
|
* @private
|
|
|
|
* @returns {Props}
|
|
|
|
*/
|
|
|
|
function _mapStateToProps(state, ownProps): Object {
|
2021-09-10 11:05:16 +00:00
|
|
|
const { participantID, overflowDrawer, drawerParticipant } = ownProps;
|
2021-08-04 08:51:05 +00:00
|
|
|
const { ownerId } = state['features/shared-video'];
|
|
|
|
const localParticipantId = getLocalParticipant(state).id;
|
2021-09-10 11:05:16 +00:00
|
|
|
|
|
|
|
const participant = getParticipantByIdOrUndefined(state,
|
|
|
|
overflowDrawer ? drawerParticipant?.participantID : participantID);
|
2021-07-09 12:36:19 +00:00
|
|
|
|
|
|
|
return {
|
2021-08-04 08:51:05 +00:00
|
|
|
_localVideoOwner: Boolean(ownerId === localParticipantId),
|
2021-12-15 13:18:41 +00:00
|
|
|
_participant: participant
|
2021-07-09 12:36:19 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2021-12-15 13:18:41 +00:00
|
|
|
export default translate(connect(_mapStateToProps)(MeetingParticipantContextMenu));
|