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

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