2019-06-19 13:32:09 +00:00
|
|
|
// @flow
|
|
|
|
|
|
|
|
import { translate } from '../../../base/i18n';
|
2022-11-08 10:24:32 +00:00
|
|
|
import { IconEnlarge } from '../../../base/icons';
|
2019-06-19 13:32:09 +00:00
|
|
|
import { pinParticipant } from '../../../base/participants';
|
|
|
|
import { connect } from '../../../base/redux';
|
2020-07-24 12:14:33 +00:00
|
|
|
import { AbstractButton, type AbstractButtonProps } from '../../../base/toolbox/components';
|
2020-07-23 13:12:25 +00:00
|
|
|
import { shouldDisplayTileView } from '../../../video-layout/functions';
|
2019-06-19 13:32:09 +00:00
|
|
|
|
|
|
|
export type Props = AbstractButtonProps & {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* True if tile view is currently enabled.
|
|
|
|
*/
|
|
|
|
_tileViewEnabled: boolean,
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The redux {@code dispatch} function.
|
|
|
|
*/
|
|
|
|
dispatch: Function,
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The ID of the participant that this button is supposed to pin.
|
|
|
|
*/
|
|
|
|
participantID: string,
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The function to be used to translate i18n labels.
|
|
|
|
*/
|
|
|
|
t: Function
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* A remote video menu button which pins a participant and exist the tile view.
|
|
|
|
*/
|
|
|
|
class PinButton extends AbstractButton<Props, *> {
|
|
|
|
accessibilityLabel = 'toolbar.accessibilityLabel.show';
|
2022-11-08 10:24:32 +00:00
|
|
|
icon = IconEnlarge;
|
2019-06-19 13:32:09 +00:00
|
|
|
label = 'videothumbnail.show';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Handles clicking / pressing the button, and kicks the participant.
|
|
|
|
*
|
|
|
|
* @private
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
_handleClick() {
|
|
|
|
const { dispatch } = this.props;
|
|
|
|
|
|
|
|
// Pin participant, it will automatically exit the tile view
|
|
|
|
dispatch(pinParticipant(this.props.participantID));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Maps part of the Redux state to the props of this component.
|
|
|
|
*
|
|
|
|
* @param {Object} state - The Redux state.
|
|
|
|
* @returns {Props}
|
|
|
|
*/
|
|
|
|
function _mapStateToProps(state) {
|
2021-07-30 09:46:49 +00:00
|
|
|
const { isOpen } = state['features/participants-pane'];
|
|
|
|
|
2019-06-19 13:32:09 +00:00
|
|
|
return {
|
2021-07-30 09:46:49 +00:00
|
|
|
visible: !isOpen && shouldDisplayTileView(state)
|
2019-06-19 13:32:09 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
export default translate(connect(_mapStateToProps)(PinButton));
|