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

SpeakerStatsButton.tsx 1.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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 { openDialog } from '../../../base/dialog/actions';
  6. import { translate } from '../../../base/i18n/functions';
  7. import { isSpeakerStatsDisabled } from '../../functions';
  8. import AbstractSpeakerStatsButton from '../AbstractSpeakerStatsButton';
  9. import SpeakerStats from './SpeakerStats';
  10. /**
  11. * Implementation of a button for opening speaker stats dialog.
  12. */
  13. class SpeakerStatsButton extends AbstractSpeakerStatsButton {
  14. /**
  15. * Handles clicking / pressing the button, and opens the appropriate dialog.
  16. *
  17. * @protected
  18. * @returns {void}
  19. */
  20. _handleClick() {
  21. const { dispatch } = this.props;
  22. sendAnalytics(createToolbarEvent('speaker.stats'));
  23. dispatch(openDialog(SpeakerStats));
  24. }
  25. }
  26. /**
  27. * Function that maps parts of Redux state tree into component props.
  28. *
  29. * @param {Object} state - Redux state.
  30. * @returns {Object}
  31. */
  32. const mapStateToProps = (state: IReduxState) => {
  33. return {
  34. visible: !isSpeakerStatsDisabled(state)
  35. };
  36. };
  37. export default translate(connect(mapStateToProps)(SpeakerStatsButton));