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.ts 1.7KB

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