2020-05-20 08:25:31 +00:00
|
|
|
// @flow
|
|
|
|
|
2022-09-13 07:36:00 +00:00
|
|
|
import { withStyles } from '@mui/styles';
|
2020-05-20 08:25:31 +00:00
|
|
|
import React, { PureComponent } from 'react';
|
|
|
|
|
2021-08-24 13:44:28 +00:00
|
|
|
import { connect } from '../../../../base/redux';
|
2021-08-20 08:53:11 +00:00
|
|
|
import DeviceStatus from '../../../../prejoin/components/preview/DeviceStatus';
|
|
|
|
import { Toolbox } from '../../../../toolbox/components/web';
|
2022-08-26 08:53:47 +00:00
|
|
|
import { getConferenceName } from '../../../conference/functions';
|
2021-08-24 13:44:28 +00:00
|
|
|
import { PREMEETING_BUTTONS, THIRD_PARTY_PREJOIN_BUTTONS } from '../../../config/constants';
|
2022-04-19 14:31:58 +00:00
|
|
|
import { getToolbarButtons, isToolbarButtonEnabled } from '../../../config/functions.web';
|
2022-08-22 13:26:35 +00:00
|
|
|
import { withPixelLineHeight } from '../../../styles/functions.web';
|
2020-05-20 08:25:31 +00:00
|
|
|
|
2020-07-29 10:27:32 +00:00
|
|
|
import ConnectionStatus from './ConnectionStatus';
|
2020-05-20 08:25:31 +00:00
|
|
|
import Preview from './Preview';
|
|
|
|
|
|
|
|
type Props = {
|
|
|
|
|
2021-08-24 13:44:28 +00:00
|
|
|
/**
|
|
|
|
* The list of toolbar buttons to render.
|
|
|
|
*/
|
|
|
|
_buttons: Array<string>,
|
|
|
|
|
2021-08-26 09:26:38 +00:00
|
|
|
/**
|
|
|
|
* The branding background of the premeeting screen(lobby/prejoin).
|
|
|
|
*/
|
|
|
|
_premeetingBackground: string,
|
|
|
|
|
2022-08-22 13:26:35 +00:00
|
|
|
/**
|
|
|
|
* The name of the meeting that is about to be joined.
|
|
|
|
*/
|
|
|
|
_roomName: string,
|
|
|
|
|
2020-05-20 08:25:31 +00:00
|
|
|
/**
|
|
|
|
* Children component(s) to be rendered on the screen.
|
|
|
|
*/
|
2021-08-20 08:53:11 +00:00
|
|
|
children?: React$Node,
|
2020-05-20 08:25:31 +00:00
|
|
|
|
2022-08-22 13:26:35 +00:00
|
|
|
/**
|
|
|
|
* Classes prop injected by withStyles.
|
|
|
|
*/
|
|
|
|
classes: Object,
|
|
|
|
|
2020-05-20 08:25:31 +00:00
|
|
|
/**
|
2021-08-20 08:53:11 +00:00
|
|
|
* Additional CSS class names to set on the icon container.
|
2020-05-20 08:25:31 +00:00
|
|
|
*/
|
2021-08-20 08:53:11 +00:00
|
|
|
className?: string,
|
2020-05-20 08:25:31 +00:00
|
|
|
|
2020-07-03 07:08:21 +00:00
|
|
|
/**
|
|
|
|
* The name of the participant.
|
|
|
|
*/
|
|
|
|
name?: string,
|
|
|
|
|
2021-06-22 17:07:57 +00:00
|
|
|
/**
|
2021-11-04 21:10:43 +00:00
|
|
|
* Indicates whether the copy url button should be shown.
|
2021-06-22 17:07:57 +00:00
|
|
|
*/
|
|
|
|
showCopyUrlButton: boolean,
|
|
|
|
|
2020-06-29 07:45:58 +00:00
|
|
|
/**
|
2021-11-04 21:10:43 +00:00
|
|
|
* Indicates whether the device status should be shown.
|
2020-06-29 07:45:58 +00:00
|
|
|
*/
|
2021-08-20 08:53:11 +00:00
|
|
|
showDeviceStatus: boolean,
|
2020-06-29 07:45:58 +00:00
|
|
|
|
|
|
|
/**
|
2021-08-20 08:53:11 +00:00
|
|
|
* The 'Skip prejoin' button to be rendered (if any).
|
2020-06-29 07:45:58 +00:00
|
|
|
*/
|
2021-08-20 08:53:11 +00:00
|
|
|
skipPrejoinButton?: React$Node,
|
2020-06-29 07:45:58 +00:00
|
|
|
|
2020-05-20 08:25:31 +00:00
|
|
|
/**
|
|
|
|
* Title of the screen.
|
|
|
|
*/
|
2021-08-20 08:53:11 +00:00
|
|
|
title?: string,
|
2020-05-20 08:25:31 +00:00
|
|
|
|
2020-07-15 08:06:14 +00:00
|
|
|
/**
|
2021-08-24 13:44:28 +00:00
|
|
|
* Whether it's used in the 3rdParty prejoin screen or not.
|
2020-07-15 08:06:14 +00:00
|
|
|
*/
|
2021-08-24 13:44:28 +00:00
|
|
|
thirdParty?: boolean,
|
2020-07-15 08:06:14 +00:00
|
|
|
|
2020-05-20 08:25:31 +00:00
|
|
|
/**
|
|
|
|
* True if the preview overlay should be muted, false otherwise.
|
|
|
|
*/
|
|
|
|
videoMuted?: boolean,
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The video track to render as preview (if omitted, the default local track will be rendered).
|
|
|
|
*/
|
2021-08-20 08:53:11 +00:00
|
|
|
videoTrack?: Object
|
2020-05-20 08:25:31 +00:00
|
|
|
}
|
|
|
|
|
2022-08-22 13:26:35 +00:00
|
|
|
/**
|
|
|
|
* Creates the styles for the component.
|
|
|
|
*
|
|
|
|
* @param {Object} theme - The current UI theme.
|
|
|
|
*
|
|
|
|
* @returns {Object}
|
|
|
|
*/
|
|
|
|
const styles = theme => {
|
|
|
|
return {
|
|
|
|
subtitle: {
|
|
|
|
...withPixelLineHeight(theme.typography.heading5),
|
|
|
|
color: theme.palette.text01,
|
|
|
|
marginBottom: theme.spacing(4),
|
|
|
|
overflow: 'hidden',
|
|
|
|
textAlign: 'center',
|
|
|
|
textOverflow: 'ellipsis',
|
|
|
|
whiteSpace: 'nowrap',
|
|
|
|
width: '100%'
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2020-05-20 08:25:31 +00:00
|
|
|
/**
|
|
|
|
* Implements a pre-meeting screen that can be used at various pre-meeting phases, for example
|
|
|
|
* on the prejoin screen (pre-connection) or lobby (post-connection).
|
|
|
|
*/
|
2021-08-24 13:44:28 +00:00
|
|
|
class PreMeetingScreen extends PureComponent<Props> {
|
2020-06-29 07:45:58 +00:00
|
|
|
/**
|
|
|
|
* Default values for {@code Prejoin} component's properties.
|
|
|
|
*
|
|
|
|
* @static
|
|
|
|
*/
|
|
|
|
static defaultProps = {
|
2021-06-22 17:07:57 +00:00
|
|
|
showCopyUrlButton: true,
|
2021-08-20 08:53:11 +00:00
|
|
|
showToolbox: true
|
2020-06-29 07:45:58 +00:00
|
|
|
};
|
|
|
|
|
2020-05-20 08:25:31 +00:00
|
|
|
/**
|
|
|
|
* Implements {@code PureComponent#render}.
|
|
|
|
*
|
|
|
|
* @inheritdoc
|
|
|
|
*/
|
|
|
|
render() {
|
2021-06-22 17:07:57 +00:00
|
|
|
const {
|
2021-08-24 13:44:28 +00:00
|
|
|
_buttons,
|
2021-08-26 09:26:38 +00:00
|
|
|
_premeetingBackground,
|
2022-08-22 13:26:35 +00:00
|
|
|
_roomName,
|
2021-08-20 08:53:11 +00:00
|
|
|
children,
|
2022-08-22 13:26:35 +00:00
|
|
|
classes,
|
2021-08-20 08:53:11 +00:00
|
|
|
className,
|
|
|
|
showDeviceStatus,
|
|
|
|
skipPrejoinButton,
|
2021-06-22 17:07:57 +00:00
|
|
|
title,
|
|
|
|
videoMuted,
|
2021-08-20 08:53:11 +00:00
|
|
|
videoTrack
|
2021-06-22 17:07:57 +00:00
|
|
|
} = this.props;
|
2021-08-20 08:53:11 +00:00
|
|
|
|
|
|
|
const containerClassName = `premeeting-screen ${className ? className : ''}`;
|
2021-08-26 09:26:38 +00:00
|
|
|
const style = _premeetingBackground ? {
|
|
|
|
background: _premeetingBackground,
|
|
|
|
backgroundPosition: 'center',
|
|
|
|
backgroundSize: 'cover'
|
|
|
|
} : {};
|
2020-05-20 08:25:31 +00:00
|
|
|
|
|
|
|
return (
|
2021-08-20 08:53:11 +00:00
|
|
|
<div className = { containerClassName }>
|
2021-08-26 09:26:38 +00:00
|
|
|
<div style = { style }>
|
|
|
|
<div className = 'content'>
|
|
|
|
<ConnectionStatus />
|
|
|
|
|
|
|
|
<div className = 'content-controls'>
|
|
|
|
<h1 className = 'title'>
|
|
|
|
{ title }
|
|
|
|
</h1>
|
2022-09-09 17:10:50 +00:00
|
|
|
{ _roomName && (
|
|
|
|
<span className = { classes.subtitle }>
|
|
|
|
{_roomName}
|
|
|
|
</span>
|
|
|
|
)}
|
2021-08-26 09:26:38 +00:00
|
|
|
{ children }
|
|
|
|
{ _buttons.length && <Toolbox toolbarButtons = { _buttons } /> }
|
|
|
|
{ skipPrejoinButton }
|
|
|
|
{ showDeviceStatus && <DeviceStatus /> }
|
|
|
|
</div>
|
2020-05-20 08:25:31 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
2021-08-20 08:53:11 +00:00
|
|
|
<Preview
|
|
|
|
videoMuted = { videoMuted }
|
|
|
|
videoTrack = { videoTrack } />
|
2020-05-20 08:25:31 +00:00
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
2021-08-24 13:44:28 +00:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Maps (parts of) the redux state to the React {@code Component} props.
|
|
|
|
*
|
|
|
|
* @param {Object} state - The redux state.
|
|
|
|
* @param {Object} ownProps - The props passed to the component.
|
|
|
|
* @returns {Object}
|
|
|
|
*/
|
|
|
|
function mapStateToProps(state, ownProps): Object {
|
2022-09-12 06:43:35 +00:00
|
|
|
const { hiddenPremeetingButtons, hideConferenceSubject } = state['features/base/config'];
|
2022-04-19 14:31:58 +00:00
|
|
|
const toolbarButtons = getToolbarButtons(state);
|
|
|
|
const premeetingButtons = (ownProps.thirdParty
|
2021-08-24 13:44:28 +00:00
|
|
|
? THIRD_PARTY_PREJOIN_BUTTONS
|
2022-04-19 14:31:58 +00:00
|
|
|
: PREMEETING_BUTTONS).filter(b => !(hiddenPremeetingButtons || []).includes(b));
|
|
|
|
|
2021-08-26 09:26:38 +00:00
|
|
|
const { premeetingBackground } = state['features/dynamic-branding'];
|
2021-08-24 13:44:28 +00:00
|
|
|
|
|
|
|
return {
|
2022-04-19 14:31:58 +00:00
|
|
|
// For keeping backwards compat.: if we pass an empty hiddenPremeetingButtons
|
|
|
|
// array through external api, we have all prejoin buttons present on premeeting
|
|
|
|
// screen regardless of passed values into toolbarButtons config overwrite.
|
|
|
|
// If hiddenPremeetingButtons is missing, we hide the buttons according to
|
|
|
|
// toolbarButtons config overwrite.
|
|
|
|
_buttons: hiddenPremeetingButtons
|
|
|
|
? premeetingButtons
|
|
|
|
: premeetingButtons.filter(b => isToolbarButtonEnabled(b, toolbarButtons)),
|
2022-08-22 13:26:35 +00:00
|
|
|
_premeetingBackground: premeetingBackground,
|
2022-09-12 06:43:35 +00:00
|
|
|
_roomName: hideConferenceSubject ? undefined : getConferenceName(state)
|
2021-08-24 13:44:28 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2022-08-22 13:26:35 +00:00
|
|
|
export default connect(mapStateToProps)(withStyles(styles)(PreMeetingScreen));
|