2018-04-18 10:15:37 +00:00
|
|
|
// @flow
|
|
|
|
|
|
|
|
import React, { Component } from 'react';
|
|
|
|
|
2020-03-04 11:01:54 +00:00
|
|
|
import { connect, equals } from '../../../base/redux';
|
2018-05-10 23:01:55 +00:00
|
|
|
import { SettingsButton } from '../../../settings';
|
2018-04-18 10:15:37 +00:00
|
|
|
import {
|
|
|
|
AudioMuteButton,
|
|
|
|
HangupButton,
|
|
|
|
VideoMuteButton
|
2020-07-24 12:14:33 +00:00
|
|
|
} from '../../../toolbox/components';
|
2018-04-18 10:15:37 +00:00
|
|
|
|
|
|
|
declare var interfaceConfig: Object;
|
|
|
|
|
2020-02-25 15:09:52 +00:00
|
|
|
// XXX: We are not currently using state here, but in the future, when
|
|
|
|
// interfaceConfig is part of redux we will. This has to be retrieved from the store.
|
|
|
|
const visibleButtons = new Set(interfaceConfig.TOOLBAR_BUTTONS);
|
|
|
|
|
2018-05-03 17:36:29 +00:00
|
|
|
/**
|
|
|
|
* The type of the React {@code Component} props of {@link Toolbar}.
|
|
|
|
*/
|
2018-04-18 10:15:37 +00:00
|
|
|
type Props = {
|
|
|
|
|
|
|
|
/**
|
2018-05-03 17:36:29 +00:00
|
|
|
* The set of buttons which should be visible in this {@code Toolbar}.
|
2018-04-18 10:15:37 +00:00
|
|
|
*/
|
|
|
|
_visibleButtons: Set<string>
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
2018-05-03 17:36:29 +00:00
|
|
|
* Implements the conference toolbar on React/Web for filmstrip-only mode.
|
2018-04-18 10:15:37 +00:00
|
|
|
*
|
|
|
|
* @extends Component
|
|
|
|
*/
|
|
|
|
class Toolbar extends Component<Props> {
|
|
|
|
/**
|
|
|
|
* Implements React's {@link Component#render()}.
|
|
|
|
*
|
|
|
|
* @inheritdoc
|
|
|
|
* @returns {ReactElement}
|
|
|
|
*/
|
|
|
|
render() {
|
|
|
|
return (
|
|
|
|
<div
|
|
|
|
className = 'filmstrip-toolbox'
|
|
|
|
id = 'new-toolbox'>
|
|
|
|
<HangupButton
|
|
|
|
tooltipPosition = 'left'
|
|
|
|
visible = { this._shouldShowButton('hangup') } />
|
2019-10-21 15:31:44 +00:00
|
|
|
<AudioMuteButton
|
|
|
|
tooltipPosition = 'left'
|
|
|
|
visible = { this._shouldShowButton('microphone') } />
|
2018-04-18 10:15:37 +00:00
|
|
|
<VideoMuteButton
|
|
|
|
tooltipPosition = 'left'
|
|
|
|
visible = { this._shouldShowButton('camera') } />
|
|
|
|
<SettingsButton
|
|
|
|
tooltipPosition = 'left'
|
|
|
|
visible = { this._shouldShowButton('fodeviceselection') } />
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
_shouldShowButton: (string) => boolean;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns if a button name has been explicitly configured to be displayed.
|
|
|
|
*
|
|
|
|
* @param {string} buttonName - The name of the button, as expected in
|
|
|
|
* {@link intefaceConfig}.
|
|
|
|
* @private
|
|
|
|
* @returns {boolean} True if the button should be displayed, false
|
|
|
|
* otherwise.
|
|
|
|
*/
|
|
|
|
_shouldShowButton(buttonName) {
|
|
|
|
return this.props._visibleButtons.has(buttonName);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Maps (parts of) the redux state to the associated props for this component.
|
|
|
|
*
|
|
|
|
* @param {Object} state - The Redux state.
|
|
|
|
* @private
|
|
|
|
* @returns {{
|
|
|
|
* _visibleButtons: Set<string>
|
|
|
|
* }}
|
|
|
|
*/
|
|
|
|
function _mapStateToProps(state): Object { // eslint-disable-line no-unused-vars
|
|
|
|
// XXX: We are not currently using state here, but in the future, when
|
|
|
|
// interfaceConfig is part of redux we will.
|
2020-03-04 11:01:54 +00:00
|
|
|
//
|
|
|
|
// NB: We compute the buttons again here because if URL parameters were used to
|
|
|
|
// override them we'd miss it.
|
|
|
|
const buttons = new Set(interfaceConfig.TOOLBAR_BUTTONS);
|
2018-04-18 10:15:37 +00:00
|
|
|
|
|
|
|
return {
|
2020-03-04 11:01:54 +00:00
|
|
|
_visibleButtons: equals(visibleButtons, buttons) ? visibleButtons : buttons
|
2018-04-18 10:15:37 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
export default connect(_mapStateToProps)(Toolbar);
|