2021-04-21 13:48:05 +00:00
|
|
|
// @flow
|
|
|
|
|
2021-10-22 13:23:52 +00:00
|
|
|
import { withStyles } from '@material-ui/core';
|
2021-07-09 12:36:19 +00:00
|
|
|
import React, { Component } from 'react';
|
2021-04-21 13:48:05 +00:00
|
|
|
|
2022-07-20 06:19:59 +00:00
|
|
|
import Button from '../../../base/components/common/Button';
|
2021-10-22 13:23:52 +00:00
|
|
|
import participantsPaneTheme from '../../../base/components/themes/participantsPaneTheme.json';
|
2021-07-12 15:14:38 +00:00
|
|
|
import { openDialog } from '../../../base/dialog';
|
|
|
|
import { translate } from '../../../base/i18n';
|
2021-10-22 13:23:52 +00:00
|
|
|
import { Icon, IconClose, IconHorizontalPoints } from '../../../base/icons';
|
2022-05-19 08:48:54 +00:00
|
|
|
import { isLocalParticipantModerator } from '../../../base/participants/functions';
|
2022-07-20 06:19:59 +00:00
|
|
|
import { BUTTON_TYPES } from '../../../base/react/constants';
|
2021-07-12 15:14:38 +00:00
|
|
|
import { connect } from '../../../base/redux';
|
2022-04-29 09:30:49 +00:00
|
|
|
import { isAddBreakoutRoomButtonVisible } from '../../../breakout-rooms/functions';
|
2021-07-12 15:14:38 +00:00
|
|
|
import { MuteEveryoneDialog } from '../../../video-menu/components/';
|
|
|
|
import { close } from '../../actions';
|
2022-04-29 09:30:49 +00:00
|
|
|
import {
|
|
|
|
findAncestorByClass,
|
|
|
|
getParticipantsPaneOpen,
|
|
|
|
isMoreActionsVisible,
|
|
|
|
isMuteAllVisible
|
|
|
|
} from '../../functions';
|
2022-01-12 16:29:58 +00:00
|
|
|
import { AddBreakoutRoomButton } from '../breakout-rooms/components/web/AddBreakoutRoomButton';
|
|
|
|
import { RoomList } from '../breakout-rooms/components/web/RoomList';
|
2021-04-21 13:48:05 +00:00
|
|
|
|
2021-10-22 13:23:52 +00:00
|
|
|
import { FooterContextMenu } from './FooterContextMenu';
|
2021-09-10 11:05:16 +00:00
|
|
|
import LobbyParticipants from './LobbyParticipants';
|
|
|
|
import MeetingParticipants from './MeetingParticipants';
|
2021-04-21 13:48:05 +00:00
|
|
|
|
2021-07-09 12:36:19 +00:00
|
|
|
/**
|
|
|
|
* The type of the React {@code Component} props of {@link ParticipantsPane}.
|
|
|
|
*/
|
|
|
|
type Props = {
|
2021-06-23 11:23:44 +00:00
|
|
|
|
2021-09-14 15:31:30 +00:00
|
|
|
/**
|
|
|
|
* Whether there is backend support for Breakout Rooms.
|
|
|
|
*/
|
|
|
|
_isBreakoutRoomsSupported: Boolean,
|
|
|
|
|
2021-09-10 11:05:16 +00:00
|
|
|
/**
|
|
|
|
* Whether to display the context menu as a drawer.
|
|
|
|
*/
|
|
|
|
_overflowDrawer: boolean,
|
|
|
|
|
2022-04-29 09:30:49 +00:00
|
|
|
/**
|
|
|
|
* Is the participants pane open.
|
|
|
|
*/
|
|
|
|
_paneOpen: boolean,
|
|
|
|
|
2021-09-14 15:31:30 +00:00
|
|
|
/**
|
|
|
|
* Should the add breakout room button be displayed?
|
|
|
|
*/
|
|
|
|
_showAddRoomButton: boolean,
|
|
|
|
|
2021-07-09 12:36:19 +00:00
|
|
|
/**
|
2022-04-29 09:30:49 +00:00
|
|
|
* Whether to show the more actions button.
|
2021-07-09 12:36:19 +00:00
|
|
|
*/
|
2022-04-29 09:30:49 +00:00
|
|
|
_showMoreActionsButton: boolean,
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Whether to show the mute all button.
|
|
|
|
*/
|
|
|
|
_showMuteAllButton: boolean,
|
2021-04-21 13:48:05 +00:00
|
|
|
|
2021-07-09 12:36:19 +00:00
|
|
|
/**
|
|
|
|
* Whether to show the footer menu.
|
|
|
|
*/
|
|
|
|
_showFooter: boolean,
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The Redux dispatch function.
|
|
|
|
*/
|
|
|
|
dispatch: Function,
|
|
|
|
|
2021-10-22 13:23:52 +00:00
|
|
|
/**
|
|
|
|
* An object containing the CSS classes.
|
|
|
|
*/
|
|
|
|
classes: Object,
|
|
|
|
|
2021-07-09 12:36:19 +00:00
|
|
|
/**
|
|
|
|
* The i18n translate function.
|
|
|
|
*/
|
|
|
|
t: Function
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The type of the React {@code Component} state of {@link ParticipantsPane}.
|
|
|
|
*/
|
|
|
|
type State = {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Indicates if the footer context menu is open.
|
|
|
|
*/
|
|
|
|
contextOpen: boolean,
|
2021-12-21 12:51:39 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Participants search string.
|
|
|
|
*/
|
|
|
|
searchString: string
|
2021-07-09 12:36:19 +00:00
|
|
|
};
|
|
|
|
|
2021-10-22 13:23:52 +00:00
|
|
|
const styles = theme => {
|
|
|
|
return {
|
|
|
|
container: {
|
|
|
|
boxSizing: 'border-box',
|
|
|
|
flex: 1,
|
|
|
|
overflowY: 'auto',
|
|
|
|
position: 'relative',
|
|
|
|
padding: `0 ${participantsPaneTheme.panePadding}px`,
|
|
|
|
|
|
|
|
[`& > * + *:not(.${participantsPaneTheme.ignoredChildClassName})`]: {
|
|
|
|
marginTop: theme.spacing(3)
|
|
|
|
},
|
|
|
|
|
|
|
|
'&::-webkit-scrollbar': {
|
|
|
|
display: 'none'
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
closeButton: {
|
|
|
|
alignItems: 'center',
|
|
|
|
cursor: 'pointer',
|
|
|
|
display: 'flex',
|
|
|
|
justifyContent: 'center'
|
|
|
|
},
|
|
|
|
|
|
|
|
header: {
|
|
|
|
alignItems: 'center',
|
|
|
|
boxSizing: 'border-box',
|
|
|
|
display: 'flex',
|
|
|
|
height: `${participantsPaneTheme.headerSize}px`,
|
|
|
|
padding: '0 20px',
|
|
|
|
justifyContent: 'flex-end'
|
|
|
|
},
|
|
|
|
|
|
|
|
antiCollapse: {
|
|
|
|
fontSize: 0,
|
|
|
|
|
|
|
|
'&:first-child': {
|
|
|
|
display: 'none'
|
|
|
|
},
|
|
|
|
|
|
|
|
'&:first-child + *': {
|
|
|
|
marginTop: 0
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
footer: {
|
|
|
|
display: 'flex',
|
|
|
|
justifyContent: 'flex-end',
|
|
|
|
padding: `${theme.spacing(4)}px ${participantsPaneTheme.panePadding}px`,
|
|
|
|
|
|
|
|
'& > *:not(:last-child)': {
|
|
|
|
marginRight: `${theme.spacing(3)}px`
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
footerMoreContainer: {
|
|
|
|
position: 'relative'
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2021-07-09 12:36:19 +00:00
|
|
|
/**
|
|
|
|
* Implements the participants list.
|
|
|
|
*/
|
|
|
|
class ParticipantsPane extends Component<Props, State> {
|
|
|
|
/**
|
|
|
|
* Initializes a new {@code ParticipantsPane} instance.
|
|
|
|
*
|
|
|
|
* @inheritdoc
|
|
|
|
*/
|
|
|
|
constructor(props) {
|
|
|
|
super(props);
|
|
|
|
|
|
|
|
this.state = {
|
2021-12-21 12:51:39 +00:00
|
|
|
contextOpen: false,
|
|
|
|
searchString: ''
|
2021-07-09 12:36:19 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
// Bind event handlers so they are only bound once per instance.
|
|
|
|
this._onClosePane = this._onClosePane.bind(this);
|
2021-09-10 11:05:16 +00:00
|
|
|
this._onDrawerClose = this._onDrawerClose.bind(this);
|
2021-07-09 12:36:19 +00:00
|
|
|
this._onKeyPress = this._onKeyPress.bind(this);
|
|
|
|
this._onMuteAll = this._onMuteAll.bind(this);
|
|
|
|
this._onToggleContext = this._onToggleContext.bind(this);
|
|
|
|
this._onWindowClickListener = this._onWindowClickListener.bind(this);
|
2021-12-21 12:51:39 +00:00
|
|
|
this.setSearchString = this.setSearchString.bind(this);
|
2021-07-09 12:36:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Implements React's {@link Component#componentDidMount()}.
|
|
|
|
*
|
|
|
|
* @inheritdoc
|
|
|
|
*/
|
|
|
|
componentDidMount() {
|
|
|
|
window.addEventListener('click', this._onWindowClickListener);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Implements React's {@link Component#componentWillUnmount()}.
|
|
|
|
*
|
|
|
|
* @inheritdoc
|
|
|
|
*/
|
|
|
|
componentWillUnmount() {
|
|
|
|
window.removeEventListener('click', this._onWindowClickListener);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Implements React's {@link Component#render}.
|
|
|
|
*
|
|
|
|
* @inheritdoc
|
|
|
|
*/
|
|
|
|
render() {
|
|
|
|
const {
|
2021-09-14 15:31:30 +00:00
|
|
|
_isBreakoutRoomsSupported,
|
2021-07-09 12:36:19 +00:00
|
|
|
_paneOpen,
|
2021-09-14 15:31:30 +00:00
|
|
|
_showAddRoomButton,
|
2021-07-09 12:36:19 +00:00
|
|
|
_showFooter,
|
2022-04-29 09:30:49 +00:00
|
|
|
_showMoreActionsButton,
|
|
|
|
_showMuteAllButton,
|
2021-10-22 13:23:52 +00:00
|
|
|
classes,
|
2021-07-09 12:36:19 +00:00
|
|
|
t
|
|
|
|
} = this.props;
|
2021-12-21 12:51:39 +00:00
|
|
|
const { contextOpen, searchString } = this.state;
|
2021-07-09 12:36:19 +00:00
|
|
|
|
|
|
|
// when the pane is not open optimize to not
|
|
|
|
// execute the MeetingParticipantList render for large list of participants
|
|
|
|
if (!_paneOpen) {
|
|
|
|
return null;
|
2021-06-10 12:48:44 +00:00
|
|
|
}
|
2021-07-09 12:36:19 +00:00
|
|
|
|
|
|
|
return (
|
2022-03-29 09:01:48 +00:00
|
|
|
<div className = 'participants_pane'>
|
2021-10-22 13:23:52 +00:00
|
|
|
<div className = 'participants_pane-content'>
|
|
|
|
<div className = { classes.header }>
|
|
|
|
<div
|
|
|
|
aria-label = { t('participantsPane.close', 'Close') }
|
|
|
|
className = { classes.closeButton }
|
|
|
|
onClick = { this._onClosePane }
|
|
|
|
onKeyPress = { this._onKeyPress }
|
|
|
|
role = 'button'
|
|
|
|
tabIndex = { 0 }>
|
|
|
|
<Icon
|
|
|
|
size = { 24 }
|
|
|
|
src = { IconClose } />
|
|
|
|
</div>
|
2021-07-09 12:36:19 +00:00
|
|
|
</div>
|
2021-10-22 13:23:52 +00:00
|
|
|
<div className = { classes.container }>
|
|
|
|
<LobbyParticipants />
|
|
|
|
<br className = { classes.antiCollapse } />
|
2021-12-21 12:51:39 +00:00
|
|
|
<MeetingParticipants
|
|
|
|
searchString = { searchString }
|
|
|
|
setSearchString = { this.setSearchString } />
|
|
|
|
{_isBreakoutRoomsSupported && <RoomList searchString = { searchString } />}
|
2021-09-14 15:31:30 +00:00
|
|
|
{_showAddRoomButton && <AddBreakoutRoomButton />}
|
2021-10-22 13:23:52 +00:00
|
|
|
</div>
|
|
|
|
{_showFooter && (
|
|
|
|
<div className = { classes.footer }>
|
2022-04-29 09:30:49 +00:00
|
|
|
{_showMuteAllButton && (
|
2022-07-20 06:19:59 +00:00
|
|
|
<Button
|
2022-04-29 09:30:49 +00:00
|
|
|
accessibilityLabel = { t('participantsPane.actions.muteAll') }
|
2022-07-20 06:19:59 +00:00
|
|
|
label = { t('participantsPane.actions.muteAll') }
|
|
|
|
onClick = { this._onMuteAll }
|
|
|
|
type = { BUTTON_TYPES.SECONDARY } />
|
2022-04-29 09:30:49 +00:00
|
|
|
)}
|
|
|
|
{_showMoreActionsButton && (
|
|
|
|
<div className = { classes.footerMoreContainer }>
|
2022-07-20 06:19:59 +00:00
|
|
|
<Button
|
2022-04-29 09:30:49 +00:00
|
|
|
accessibilityLabel = { t('participantsPane.actions.moreModerationActions') }
|
2022-07-20 06:19:59 +00:00
|
|
|
icon = { IconHorizontalPoints }
|
2022-04-29 09:30:49 +00:00
|
|
|
id = 'participants-pane-context-menu'
|
2022-07-20 06:19:59 +00:00
|
|
|
onClick = { this._onToggleContext }
|
|
|
|
type = { BUTTON_TYPES.SECONDARY } />
|
2022-04-29 09:30:49 +00:00
|
|
|
<FooterContextMenu
|
|
|
|
isOpen = { contextOpen }
|
|
|
|
onDrawerClose = { this._onDrawerClose }
|
|
|
|
onMouseLeave = { this._onToggleContext } />
|
|
|
|
</div>
|
|
|
|
)}
|
2021-10-22 13:23:52 +00:00
|
|
|
</div>
|
|
|
|
)}
|
2021-04-21 13:48:05 +00:00
|
|
|
</div>
|
2021-10-22 13:23:52 +00:00
|
|
|
</div>
|
2021-07-09 12:36:19 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2021-12-21 12:51:39 +00:00
|
|
|
setSearchString: (string) => void;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets the search string.
|
|
|
|
*
|
|
|
|
* @param {string} newSearchString - The new search string.
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
setSearchString(newSearchString) {
|
|
|
|
this.setState({
|
|
|
|
searchString: newSearchString
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2021-07-09 12:36:19 +00:00
|
|
|
_onClosePane: () => void;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Callback for closing the participant pane.
|
|
|
|
*
|
|
|
|
* @private
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
_onClosePane() {
|
|
|
|
this.props.dispatch(close());
|
|
|
|
}
|
|
|
|
|
2021-11-04 21:10:43 +00:00
|
|
|
_onDrawerClose: () => void;
|
2021-09-10 11:05:16 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Callback for closing the drawer.
|
|
|
|
*
|
|
|
|
* @private
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
_onDrawerClose() {
|
|
|
|
this.setState({
|
|
|
|
contextOpen: false
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2021-07-09 12:36:19 +00:00
|
|
|
_onKeyPress: (Object) => void;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* KeyPress handler for accessibility for closing the participants pane.
|
|
|
|
*
|
|
|
|
* @param {Object} e - The key event to handle.
|
|
|
|
*
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
_onKeyPress(e) {
|
|
|
|
if (e.key === ' ' || e.key === 'Enter') {
|
|
|
|
e.preventDefault();
|
|
|
|
this._onClosePane();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
_onMuteAll: () => void;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The handler for clicking mute all button.
|
|
|
|
*
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
_onMuteAll() {
|
|
|
|
this.props.dispatch(openDialog(MuteEveryoneDialog));
|
|
|
|
}
|
|
|
|
|
|
|
|
_onToggleContext: () => void;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Handler for toggling open/close of the footer context menu.
|
|
|
|
*
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
_onToggleContext() {
|
|
|
|
this.setState({
|
|
|
|
contextOpen: !this.state.contextOpen
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
_onWindowClickListener: (event: Object) => void;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Window click event listener.
|
|
|
|
*
|
|
|
|
* @param {Event} e - The click event.
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
_onWindowClickListener(e) {
|
2021-10-22 13:23:52 +00:00
|
|
|
if (this.state.contextOpen && !findAncestorByClass(e.target, this.props.classes.footerMoreContainer)) {
|
2021-07-09 12:36:19 +00:00
|
|
|
this.setState({
|
|
|
|
contextOpen: false
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
2021-09-10 11:05:16 +00:00
|
|
|
|
|
|
|
|
2021-07-09 12:36:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Maps (parts of) the redux state to the React {@code Component} props of
|
|
|
|
* {@code ParticipantsPane}.
|
|
|
|
*
|
|
|
|
* @param {Object} state - The redux state.
|
|
|
|
* @protected
|
2021-09-14 15:31:30 +00:00
|
|
|
* @returns {Props}
|
2021-07-09 12:36:19 +00:00
|
|
|
*/
|
|
|
|
function _mapStateToProps(state: Object) {
|
|
|
|
const isPaneOpen = getParticipantsPaneOpen(state);
|
2021-09-14 15:31:30 +00:00
|
|
|
const { conference } = state['features/base/conference'];
|
|
|
|
const _isBreakoutRoomsSupported = conference?.getBreakoutRooms()?.isSupported();
|
2021-07-09 12:36:19 +00:00
|
|
|
|
|
|
|
return {
|
2021-09-14 15:31:30 +00:00
|
|
|
_isBreakoutRoomsSupported,
|
2021-07-09 12:36:19 +00:00
|
|
|
_paneOpen: isPaneOpen,
|
2022-04-29 09:30:49 +00:00
|
|
|
_showAddRoomButton: isAddBreakoutRoomButtonVisible(state),
|
2022-05-19 08:48:54 +00:00
|
|
|
_showFooter: isLocalParticipantModerator(state),
|
2022-04-29 09:30:49 +00:00
|
|
|
_showMuteAllButton: isMuteAllVisible(state),
|
|
|
|
_showMoreActionsButton: isMoreActionsVisible(state)
|
2021-07-09 12:36:19 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2021-10-22 13:23:52 +00:00
|
|
|
export default translate(connect(_mapStateToProps)(withStyles(styles)(ParticipantsPane)));
|