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.

FeedbackButton.web.js 2.0KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. /* @flow */
  2. import React, { Component } from 'react';
  3. import { connect } from 'react-redux';
  4. import { openFeedbackDialog } from '../actions';
  5. /**
  6. * Implements a Web/React Component which renders a feedback button.
  7. */
  8. class FeedbackButton extends Component {
  9. _onClick: Function;
  10. static propTypes = {
  11. /**
  12. * The JitsiConference for which the feedback will be about.
  13. *
  14. * @type {JitsiConference}
  15. */
  16. _conference: React.PropTypes.object
  17. };
  18. /**
  19. * Initializes a new FeedbackButton instance.
  20. *
  21. * @param {Object} props - The read-only properties with which the new
  22. * instance is to be initialized.
  23. */
  24. constructor(props: Object) {
  25. super(props);
  26. // Bind event handlers so they are only bound once for every instance.
  27. this._onClick = this._onClick.bind(this);
  28. }
  29. /**
  30. * Implements React's {@link Component#render()}.
  31. *
  32. * @inheritdoc
  33. * @returns {ReactElement}
  34. */
  35. render() {
  36. return (
  37. <a
  38. className = 'button icon-feedback'
  39. id = 'feedbackButton'
  40. onClick = { this._onClick } />
  41. );
  42. }
  43. /**
  44. * Dispatches an action to open a dialog requesting call feedback.
  45. *
  46. * @private
  47. * @returns {void}
  48. */
  49. _onClick() {
  50. const { _conference, dispatch } = this.props;
  51. dispatch(openFeedbackDialog(_conference));
  52. }
  53. }
  54. /**
  55. * Maps (parts of) the Redux state to the associated Conference's props.
  56. *
  57. * @param {Object} state - The Redux state.
  58. * @private
  59. * @returns {{
  60. * _toolboxVisible: boolean
  61. * }}
  62. */
  63. function _mapStateToProps(state) {
  64. return {
  65. /**
  66. * The JitsiConference for which the feedback will be about.
  67. *
  68. * @private
  69. * @type {JitsiConference}
  70. */
  71. _conference: state['features/base/conference'].conference
  72. };
  73. }
  74. export default connect(_mapStateToProps)(FeedbackButton);