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.

SpeakerStatsButton.js 1.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. // @flow
  2. import { createToolbarEvent, sendAnalytics } from '../../../analytics';
  3. import { getFeatureFlag, SPEAKERSTATS_ENABLED } from '../../../base/flags';
  4. import { translate } from '../../../base/i18n';
  5. import { connect } from '../../../base/redux';
  6. import { navigate } from '../../../mobile/navigation/components/conference/ConferenceNavigationContainerRef';
  7. import { screen } from '../../../mobile/navigation/routes';
  8. import AbstractSpeakerStatsButton from '../AbstractSpeakerStatsButton';
  9. /**
  10. * Implementation of a button for opening speaker stats dialog.
  11. */
  12. class SpeakerStatsButton extends AbstractSpeakerStatsButton {
  13. /**
  14. * Handles clicking / pressing the button, and opens the appropriate dialog.
  15. *
  16. * @protected
  17. * @returns {void}
  18. */
  19. _handleClick() {
  20. sendAnalytics(createToolbarEvent('speaker.stats'));
  21. return navigate(screen.conference.speakerStats);
  22. }
  23. }
  24. /**
  25. * Maps (parts of) the redux state to the associated props for the
  26. * {@code SpeakerStatsButton} component.
  27. *
  28. * @param {Object} state - The Redux state.
  29. * @private
  30. * @returns {{
  31. * visible: boolean
  32. * }}
  33. */
  34. function _mapStateToProps(state): Object {
  35. const enabled = getFeatureFlag(state, SPEAKERSTATS_ENABLED, true);
  36. return {
  37. visible: enabled
  38. };
  39. }
  40. export default translate(connect(_mapStateToProps)(SpeakerStatsButton));