123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126 |
- // @flow
-
- import React from 'react';
- import { SafeAreaView, View } from 'react-native';
-
- import { ColorSchemeRegistry } from '../../../base/color-scheme';
- import { connect } from '../../../base/redux';
- import { StyleType } from '../../../base/styles';
- import { ChatButton } from '../../../chat';
- import { InviteButton } from '../../../invite';
- import { TileViewButton } from '../../../video-layout';
- import { isToolboxVisible, getMovableButtons } from '../../functions.native';
- import AudioMuteButton from '../AudioMuteButton';
- import HangupButton from '../HangupButton';
- import VideoMuteButton from '../VideoMuteButton';
-
- import OverflowMenuButton from './OverflowMenuButton';
- import RaiseHandButton from './RaiseHandButton';
- import ToggleCameraButton from './ToggleCameraButton';
- import styles from './styles';
-
- /**
- * The type of {@link Toolbox}'s React {@code Component} props.
- */
- type Props = {
-
- /**
- * The color-schemed stylesheet of the feature.
- */
- _styles: StyleType,
-
- /**
- * The indicator which determines whether the toolbox is visible.
- */
- _visible: boolean,
-
- /**
- * The width of the screen.
- */
- _width: number,
-
- /**
- * The redux {@code dispatch} function.
- */
- dispatch: Function
- };
-
- /**
- * Implements the conference Toolbox on React Native.
- *
- * @param {Object} props - The props of the component.
- * @returns {React$Element}.
- */
- function Toolbox(props: Props) {
- if (!props._visible) {
- return null;
- }
-
- const { _styles, _width } = props;
- const { buttonStylesBorderless, hangupButtonStyles, toggledButtonStyles } = _styles;
- const additionalButtons = getMovableButtons(_width);
- const backgroundToggledStyle = {
- ...toggledButtonStyles,
- style: [
- toggledButtonStyles.style,
- _styles.backgroundToggle
- ]
- };
-
- return (
- <View
- pointerEvents = 'box-none'
- style = { styles.toolboxContainer }>
- <SafeAreaView
- accessibilityRole = 'toolbar'
- pointerEvents = 'box-none'
- style = { styles.toolbox }>
- <AudioMuteButton
- styles = { buttonStylesBorderless }
- toggledStyles = { toggledButtonStyles } />
- <VideoMuteButton
- styles = { buttonStylesBorderless }
- toggledStyles = { toggledButtonStyles } />
- { additionalButtons.has('chat')
- && <ChatButton
- styles = { buttonStylesBorderless }
- toggledStyles = { backgroundToggledStyle } />}
-
- { additionalButtons.has('raisehand')
- && <RaiseHandButton
- styles = { buttonStylesBorderless }
- toggledStyles = { backgroundToggledStyle } />}
- {additionalButtons.has('tileview') && <TileViewButton styles = { buttonStylesBorderless } />}
- {additionalButtons.has('invite') && <InviteButton styles = { buttonStylesBorderless } />}
- {additionalButtons.has('togglecamera')
- && <ToggleCameraButton
- styles = { buttonStylesBorderless }
- toggledStyles = { backgroundToggledStyle } />}
- <OverflowMenuButton
- styles = { buttonStylesBorderless }
- toggledStyles = { toggledButtonStyles } />
- <HangupButton
- styles = { hangupButtonStyles } />
- </SafeAreaView>
- </View>
- );
- }
-
- /**
- * Maps parts of the redux state to {@link Toolbox} (React {@code Component})
- * props.
- *
- * @param {Object} state - The redux state of which parts are to be mapped to
- * {@code Toolbox} props.
- * @private
- * @returns {Props}
- */
- function _mapStateToProps(state: Object): Object {
- return {
- _styles: ColorSchemeRegistry.get(state, 'Toolbox'),
- _visible: isToolboxVisible(state),
- _width: state['features/base/responsive-ui'].clientWidth
- };
- }
-
- export default connect(_mapStateToProps)(Toolbox);
|