您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

FeedbackButton.web.js 1.5KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. // @flow
  2. import { createToolbarEvent, sendAnalytics } from '../../analytics';
  3. import { translate } from '../../base/i18n';
  4. import { IconFeedback } from '../../base/icons';
  5. import { connect } from '../../base/redux';
  6. import { AbstractButton, type AbstractButtonProps } from '../../base/toolbox/components';
  7. import { openFeedbackDialog } from '../actions';
  8. /**
  9. * The type of the React {@code Component} props of {@link FeedbackButton}.
  10. */
  11. type Props = AbstractButtonProps & {
  12. /**
  13. * The {@code JitsiConference} for the current conference.
  14. */
  15. _conference: Object,
  16. /**
  17. * The redux {@code dispatch} function.
  18. */
  19. dispatch: Function
  20. };
  21. /**
  22. * Implementation of a button for opening feedback dialog.
  23. */
  24. class FeedbackButton extends AbstractButton<Props, *> {
  25. accessibilityLabel = 'toolbar.accessibilityLabel.feedback';
  26. icon = IconFeedback;
  27. label = 'toolbar.feedback';
  28. tooltip = 'toolbar.feedback';
  29. /**
  30. * Handles clicking / pressing the button, and opens the appropriate dialog.
  31. *
  32. * @protected
  33. * @returns {void}
  34. */
  35. _handleClick() {
  36. const { _conference, dispatch, handleClick } = this.props;
  37. if (handleClick) {
  38. handleClick();
  39. return;
  40. }
  41. sendAnalytics(createToolbarEvent('feedback'));
  42. dispatch(openFeedbackDialog(_conference));
  43. }
  44. }
  45. const mapStateToProps = state => {
  46. return {
  47. _conference: state['features/base/conference'].conference
  48. };
  49. };
  50. export default translate(connect(mapStateToProps)(FeedbackButton));