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.8KB

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