2018-05-15 11:18:42 +00:00
|
|
|
// @flow
|
|
|
|
|
2019-11-25 12:01:54 +00:00
|
|
|
import React, { PureComponent } from 'react';
|
2021-08-05 09:36:25 +00:00
|
|
|
import { Divider } from 'react-native-paper';
|
2018-05-15 11:18:42 +00:00
|
|
|
|
2022-06-20 14:53:19 +00:00
|
|
|
import { BottomSheet, hideSheet } from '../../../base/dialog';
|
2022-06-10 09:46:52 +00:00
|
|
|
import { bottomSheetStyles } from '../../../base/dialog/components/native/styles';
|
2019-03-21 16:38:29 +00:00
|
|
|
import { connect } from '../../../base/redux';
|
2022-07-28 07:28:29 +00:00
|
|
|
import SettingsButton from '../../../base/settings/components/native/SettingsButton';
|
2019-10-04 15:10:19 +00:00
|
|
|
import { SharedDocumentButton } from '../../../etherpad';
|
2021-07-13 06:50:08 +00:00
|
|
|
import { ReactionMenu } from '../../../reactions/components';
|
2021-08-31 11:00:27 +00:00
|
|
|
import { isReactionsEnabled } from '../../../reactions/functions.any';
|
2018-07-05 11:17:45 +00:00
|
|
|
import { LiveStreamButton, RecordButton } from '../../../recording';
|
2021-12-10 16:23:27 +00:00
|
|
|
import SecurityDialogButton
|
|
|
|
from '../../../security/components/security-dialog/native/SecurityDialogButton';
|
2021-03-03 14:37:38 +00:00
|
|
|
import { SharedVideoButton } from '../../../shared-video/components';
|
2021-11-10 17:49:53 +00:00
|
|
|
import SpeakerStatsButton from '../../../speaker-stats/components/native/SpeakerStatsButton';
|
2022-10-17 20:40:13 +00:00
|
|
|
import { isSpeakerStatsDisabled } from '../../../speaker-stats/functions';
|
2018-08-24 18:12:12 +00:00
|
|
|
import { ClosedCaptionButton } from '../../../subtitles';
|
2018-09-13 15:20:22 +00:00
|
|
|
import { TileViewButton } from '../../../video-layout';
|
2021-08-05 09:36:25 +00:00
|
|
|
import styles from '../../../video-menu/components/native/styles';
|
2021-03-22 09:02:57 +00:00
|
|
|
import { getMovableButtons } from '../../functions.native';
|
2019-11-25 12:01:54 +00:00
|
|
|
|
|
|
|
import AudioOnlyButton from './AudioOnlyButton';
|
2022-03-08 09:10:30 +00:00
|
|
|
import LinkToSalesforceButton from './LinkToSalesforceButton';
|
2022-05-06 10:14:10 +00:00
|
|
|
import OpenCarmodeButton from './OpenCarmodeButton';
|
2021-07-22 10:17:42 +00:00
|
|
|
import RaiseHandButton from './RaiseHandButton';
|
2022-05-03 10:07:22 +00:00
|
|
|
import ScreenSharingButton from './ScreenSharingButton';
|
2018-05-15 11:18:42 +00:00
|
|
|
|
2018-05-16 21:49:03 +00:00
|
|
|
/**
|
|
|
|
* The type of the React {@code Component} props of {@link OverflowMenu}.
|
|
|
|
*/
|
2018-05-15 11:18:42 +00:00
|
|
|
type Props = {
|
|
|
|
|
2019-07-11 11:32:17 +00:00
|
|
|
/**
|
|
|
|
* True if the overflow menu is currently visible, false otherwise.
|
|
|
|
*/
|
|
|
|
_isOpen: boolean,
|
|
|
|
|
2019-05-24 15:11:54 +00:00
|
|
|
/**
|
|
|
|
* Whether the recoding button should be enabled or not.
|
|
|
|
*/
|
|
|
|
_recordingEnabled: boolean,
|
|
|
|
|
2021-03-22 09:02:57 +00:00
|
|
|
/**
|
|
|
|
* The width of the screen.
|
|
|
|
*/
|
|
|
|
_width: number,
|
|
|
|
|
2021-07-22 10:17:42 +00:00
|
|
|
/**
|
|
|
|
* Whether or not the reactions feature is enabled.
|
|
|
|
*/
|
|
|
|
_reactionsEnabled: boolean,
|
|
|
|
|
2018-05-15 11:18:42 +00:00
|
|
|
/**
|
|
|
|
* Used for hiding the dialog when the selection was completed.
|
|
|
|
*/
|
2022-10-17 20:40:13 +00:00
|
|
|
dispatch: Function,
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Whether or not speaker stats is disable.
|
|
|
|
*/
|
|
|
|
_isSpeakerStatsDisabled: boolean
|
2018-05-15 11:18:42 +00:00
|
|
|
};
|
|
|
|
|
2019-11-25 12:01:54 +00:00
|
|
|
type State = {
|
|
|
|
|
2019-12-12 13:52:41 +00:00
|
|
|
/**
|
|
|
|
* True if the bottom scheet is scrolled to the top.
|
|
|
|
*/
|
2021-07-13 06:50:08 +00:00
|
|
|
scrolledToTop: boolean
|
2019-11-25 12:01:54 +00:00
|
|
|
}
|
|
|
|
|
2018-05-15 11:18:42 +00:00
|
|
|
/**
|
|
|
|
* Implements a React {@code Component} with some extra actions in addition to
|
|
|
|
* those in the toolbar.
|
|
|
|
*/
|
2019-11-25 12:01:54 +00:00
|
|
|
class OverflowMenu extends PureComponent<Props, State> {
|
2018-05-15 11:18:42 +00:00
|
|
|
/**
|
|
|
|
* Initializes a new {@code OverflowMenu} instance.
|
|
|
|
*
|
|
|
|
* @inheritdoc
|
|
|
|
*/
|
|
|
|
constructor(props: Props) {
|
|
|
|
super(props);
|
|
|
|
|
2019-11-25 12:01:54 +00:00
|
|
|
this.state = {
|
2021-07-13 06:50:08 +00:00
|
|
|
scrolledToTop: true
|
2019-11-25 12:01:54 +00:00
|
|
|
};
|
|
|
|
|
2018-05-16 21:49:03 +00:00
|
|
|
// Bind event handlers so they are only bound once per instance.
|
2018-05-15 11:18:42 +00:00
|
|
|
this._onCancel = this._onCancel.bind(this);
|
2021-07-13 06:50:08 +00:00
|
|
|
this._renderReactionMenu = this._renderReactionMenu.bind(this);
|
2018-05-15 11:18:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Implements React's {@link Component#render()}.
|
|
|
|
*
|
|
|
|
* @inheritdoc
|
|
|
|
* @returns {ReactElement}
|
|
|
|
*/
|
|
|
|
render() {
|
2022-03-08 09:10:30 +00:00
|
|
|
const {
|
2022-10-17 20:40:13 +00:00
|
|
|
_isSpeakerStatsDisabled,
|
2022-05-23 08:29:52 +00:00
|
|
|
_reactionsEnabled,
|
|
|
|
_width
|
2022-03-08 09:10:30 +00:00
|
|
|
} = this.props;
|
2021-03-22 09:02:57 +00:00
|
|
|
const toolbarButtons = getMovableButtons(_width);
|
2019-11-25 12:01:54 +00:00
|
|
|
|
2018-05-22 09:33:03 +00:00
|
|
|
const buttonProps = {
|
|
|
|
afterClick: this._onCancel,
|
|
|
|
showLabel: true,
|
2022-06-10 09:46:52 +00:00
|
|
|
styles: bottomSheetStyles.buttons
|
2018-05-22 09:33:03 +00:00
|
|
|
};
|
|
|
|
|
2022-07-11 12:25:59 +00:00
|
|
|
const topButtonProps = {
|
|
|
|
afterClick: this._onCancel,
|
|
|
|
showLabel: true,
|
|
|
|
styles: {
|
|
|
|
...bottomSheetStyles.buttons,
|
|
|
|
style: {
|
|
|
|
...bottomSheetStyles.buttons.style,
|
|
|
|
borderTopLeftRadius: 16,
|
|
|
|
borderTopRightRadius: 16
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2018-05-15 11:18:42 +00:00
|
|
|
return (
|
2019-11-25 12:01:54 +00:00
|
|
|
<BottomSheet
|
2021-07-22 10:17:42 +00:00
|
|
|
renderFooter = { _reactionsEnabled && !toolbarButtons.has('raisehand')
|
|
|
|
? this._renderReactionMenu
|
|
|
|
: null }>
|
2022-09-26 20:33:27 +00:00
|
|
|
<OpenCarmodeButton { ...topButtonProps } />
|
2018-05-22 09:33:03 +00:00
|
|
|
<AudioOnlyButton { ...buttonProps } />
|
2021-07-22 10:17:42 +00:00
|
|
|
{!_reactionsEnabled && !toolbarButtons.has('raisehand') && <RaiseHandButton { ...buttonProps } />}
|
2021-08-05 09:36:25 +00:00
|
|
|
<Divider style = { styles.divider } />
|
2021-04-09 12:30:25 +00:00
|
|
|
<SecurityDialogButton { ...buttonProps } />
|
2021-07-13 06:50:08 +00:00
|
|
|
<RecordButton { ...buttonProps } />
|
|
|
|
<LiveStreamButton { ...buttonProps } />
|
2022-03-08 09:10:30 +00:00
|
|
|
<LinkToSalesforceButton { ...buttonProps } />
|
2021-08-05 09:36:25 +00:00
|
|
|
<Divider style = { styles.divider } />
|
2021-07-13 06:50:08 +00:00
|
|
|
<SharedVideoButton { ...buttonProps } />
|
2022-09-26 20:33:27 +00:00
|
|
|
{!toolbarButtons.has('screensharing') && <ScreenSharingButton { ...buttonProps } />}
|
2022-10-17 20:40:13 +00:00
|
|
|
{!_isSpeakerStatsDisabled && <SpeakerStatsButton { ...buttonProps } />}
|
2021-08-05 09:36:25 +00:00
|
|
|
{!toolbarButtons.has('tileview') && <TileViewButton { ...buttonProps } />}
|
|
|
|
<Divider style = { styles.divider } />
|
2021-07-13 06:50:08 +00:00
|
|
|
<ClosedCaptionButton { ...buttonProps } />
|
|
|
|
<SharedDocumentButton { ...buttonProps } />
|
2022-07-28 07:28:29 +00:00
|
|
|
<SettingsButton { ...buttonProps } />
|
2018-05-15 11:18:42 +00:00
|
|
|
</BottomSheet>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2018-05-16 21:49:03 +00:00
|
|
|
* Hides this {@code OverflowMenu}.
|
2018-05-15 11:18:42 +00:00
|
|
|
*
|
|
|
|
* @private
|
2022-06-20 14:53:19 +00:00
|
|
|
* @returns {void}
|
2018-05-15 11:18:42 +00:00
|
|
|
*/
|
|
|
|
_onCancel() {
|
2022-06-20 14:53:19 +00:00
|
|
|
this.props.dispatch(hideSheet());
|
2018-05-15 11:18:42 +00:00
|
|
|
}
|
2019-11-25 12:01:54 +00:00
|
|
|
|
|
|
|
/**
|
2021-07-13 06:50:08 +00:00
|
|
|
* Functoin to render the reaction menu as the footer of the bottom sheet.
|
2019-11-25 12:01:54 +00:00
|
|
|
*
|
2021-07-13 06:50:08 +00:00
|
|
|
* @returns {React$Element}
|
2019-11-25 12:01:54 +00:00
|
|
|
*/
|
2021-07-13 06:50:08 +00:00
|
|
|
_renderReactionMenu() {
|
|
|
|
return (<ReactionMenu
|
|
|
|
onCancel = { this._onCancel }
|
|
|
|
overflowMenu = { true } />);
|
2019-11-25 12:01:54 +00:00
|
|
|
}
|
2018-05-15 11:18:42 +00:00
|
|
|
}
|
|
|
|
|
2019-01-22 10:35:28 +00:00
|
|
|
/**
|
|
|
|
* Function that maps parts of Redux state tree into component props.
|
|
|
|
*
|
|
|
|
* @param {Object} state - Redux state.
|
|
|
|
* @private
|
2019-07-11 11:32:17 +00:00
|
|
|
* @returns {Props}
|
2019-01-22 10:35:28 +00:00
|
|
|
*/
|
|
|
|
function _mapStateToProps(state) {
|
|
|
|
return {
|
2022-10-17 20:40:13 +00:00
|
|
|
_isSpeakerStatsDisabled: isSpeakerStatsDisabled(state),
|
2022-05-23 08:29:52 +00:00
|
|
|
_reactionsEnabled: isReactionsEnabled(state),
|
|
|
|
_width: state['features/base/responsive-ui'].clientWidth
|
2019-01-22 10:35:28 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2022-06-20 14:53:19 +00:00
|
|
|
export default connect(_mapStateToProps)(OverflowMenu);
|