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.

PrivateMessageMenuButton.js 1.7KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. // @flow
  2. import React, { Component } from 'react';
  3. import { translate } from '../../../base/i18n';
  4. import { IconMessage } from '../../../base/icons';
  5. import { connect } from '../../../base/redux';
  6. import { _mapDispatchToProps, _mapStateToProps, type Props } from '../../../chat/components/PrivateMessageButton';
  7. import RemoteVideoMenuButton from './RemoteVideoMenuButton';
  8. /**
  9. * A custom implementation of the PrivateMessageButton specialized for
  10. * the web version of the remote video menu. When the web platform starts to use
  11. * the {@code AbstractButton} component for the remote video menu, we can get rid
  12. * of this component and use the generic button in the chat feature.
  13. */
  14. class PrivateMessageMenuButton extends Component<Props> {
  15. /**
  16. * Instantiates a new Component instance.
  17. *
  18. * @inheritdoc
  19. */
  20. constructor(props: Props) {
  21. super(props);
  22. this._onClick = this._onClick.bind(this);
  23. }
  24. /**
  25. * Implements React's {@link Component#render()}.
  26. *
  27. * @inheritdoc
  28. * @returns {ReactElement}
  29. */
  30. render() {
  31. const { participantID, t } = this.props;
  32. return (
  33. <RemoteVideoMenuButton
  34. buttonText = { t('toolbar.privateMessage') }
  35. icon = { IconMessage }
  36. id = { `privmsglink_${participantID}` }
  37. onClick = { this._onClick } />
  38. );
  39. }
  40. _onClick: () => void;
  41. /**
  42. * Callback to be invoked on pressing the button.
  43. *
  44. * @returns {void}
  45. */
  46. _onClick() {
  47. const { _participant, _setPrivateMessageRecipient } = this.props;
  48. _setPrivateMessageRecipient(_participant);
  49. }
  50. }
  51. export default translate(connect(_mapStateToProps, _mapDispatchToProps)(PrivateMessageMenuButton));