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

SpeakerStatsButton.js 1.8KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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, handleClick } = this.props;
  38. if (handleClick) {
  39. handleClick();
  40. return;
  41. }
  42. sendAnalytics(createToolbarEvent('speaker.stats'));
  43. dispatch(openDialog(SpeakerStats, {
  44. conference: _conference
  45. }));
  46. }
  47. }
  48. /**
  49. * Maps (parts of) the Redux state to the associated
  50. * {@code SpeakerStatsButton} component's props.
  51. *
  52. * @param {Object} state - The Redux state.
  53. * @private
  54. * @returns {Object}
  55. */
  56. function mapStateToProps(state) {
  57. return {
  58. _conference: state['features/base/conference'].conference
  59. };
  60. }
  61. export default translate(connect(mapStateToProps)(SpeakerStatsButton));