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

HangupButton.js 1.6KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. // @flow
  2. import _ from 'lodash';
  3. import { createToolbarEvent, sendAnalytics } from '../../analytics';
  4. import { leaveConference } from '../../base/conference/actions';
  5. import { translate } from '../../base/i18n';
  6. import { connect } from '../../base/redux';
  7. import { AbstractHangupButton } from '../../base/toolbox/components';
  8. import type { AbstractButtonProps } from '../../base/toolbox/components';
  9. /**
  10. * The type of the React {@code Component} props of {@link HangupButton}.
  11. */
  12. type Props = AbstractButtonProps & {
  13. /**
  14. * The redux {@code dispatch} function.
  15. */
  16. dispatch: Function
  17. };
  18. /**
  19. * Component that renders a toolbar button for leaving the current conference.
  20. *
  21. * @augments AbstractHangupButton
  22. */
  23. class HangupButton extends AbstractHangupButton<Props, *> {
  24. _hangup: Function;
  25. accessibilityLabel = 'toolbar.accessibilityLabel.hangup';
  26. label = 'toolbar.hangup';
  27. tooltip = 'toolbar.hangup';
  28. /**
  29. * Initializes a new HangupButton instance.
  30. *
  31. * @param {Props} props - The read-only properties with which the new
  32. * instance is to be initialized.
  33. */
  34. constructor(props: Props) {
  35. super(props);
  36. this._hangup = _.once(() => {
  37. sendAnalytics(createToolbarEvent('hangup'));
  38. this.props.dispatch(leaveConference());
  39. });
  40. }
  41. /**
  42. * Helper function to perform the actual hangup action.
  43. *
  44. * @override
  45. * @protected
  46. * @returns {void}
  47. */
  48. _doHangup() {
  49. this._hangup();
  50. }
  51. }
  52. export default translate(connect()(HangupButton));