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

HangupButton.ts 1.5KB

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