You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

PinButton.ts 1.7KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. import { connect } from 'react-redux';
  2. import { IReduxState } from '../../../app/types';
  3. import { translate } from '../../../base/i18n/functions';
  4. import { IconEnlarge } from '../../../base/icons/svg';
  5. import { pinParticipant } from '../../../base/participants/actions';
  6. import AbstractButton, { IProps as AbstractButtonProps } from '../../../base/toolbox/components/AbstractButton';
  7. import { shouldDisplayTileView } from '../../../video-layout/functions';
  8. export interface IProps extends AbstractButtonProps {
  9. /**
  10. * True if tile view is currently enabled.
  11. */
  12. _tileViewEnabled?: boolean;
  13. /**
  14. * The ID of the participant that this button is supposed to pin.
  15. */
  16. participantID: string;
  17. }
  18. /**
  19. * A remote video menu button which pins a participant and exist the tile view.
  20. */
  21. class PinButton extends AbstractButton<IProps> {
  22. accessibilityLabel = 'toolbar.accessibilityLabel.show';
  23. icon = IconEnlarge;
  24. label = 'videothumbnail.show';
  25. /**
  26. * Handles clicking / pressing the button, and kicks the participant.
  27. *
  28. * @private
  29. * @returns {void}
  30. */
  31. _handleClick() {
  32. const { dispatch } = this.props;
  33. // Pin participant, it will automatically exit the tile view
  34. dispatch(pinParticipant(this.props.participantID));
  35. }
  36. }
  37. /**
  38. * Maps part of the Redux state to the props of this component.
  39. *
  40. * @param {Object} state - The Redux state.
  41. * @returns {IProps}
  42. */
  43. function _mapStateToProps(state: IReduxState) {
  44. const { isOpen } = state['features/participants-pane'];
  45. return {
  46. visible: !isOpen && shouldDisplayTileView(state)
  47. };
  48. }
  49. export default translate(connect(_mapStateToProps)(PinButton));