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.js 1.6KB

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