Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

FeedbackButton.web.js 2.5KB

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