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

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