1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- // @flow
-
- import _ from 'lodash';
-
- import { createToolbarEvent, sendAnalytics } from '../../analytics';
- import { leaveConference } from '../../base/conference/actions';
- import { translate } from '../../base/i18n';
- import { connect } from '../../base/redux';
- import { AbstractHangupButton } from '../../base/toolbox/components';
- import type { AbstractButtonProps } from '../../base/toolbox/components';
-
- /**
- * The type of the React {@code Component} props of {@link HangupButton}.
- */
- type Props = AbstractButtonProps & {
-
- /**
- * The redux {@code dispatch} function.
- */
- dispatch: Function
- };
-
- /**
- * Component that renders a toolbar button for leaving the current conference.
- *
- * @augments AbstractHangupButton
- */
- class HangupButton extends AbstractHangupButton<Props, *> {
- _hangup: Function;
-
- accessibilityLabel = 'toolbar.accessibilityLabel.hangup';
- label = 'toolbar.hangup';
- tooltip = 'toolbar.hangup';
-
- /**
- * Initializes a new HangupButton instance.
- *
- * @param {Props} props - The read-only properties with which the new
- * instance is to be initialized.
- */
- constructor(props: Props) {
- super(props);
-
- this._hangup = _.once(() => {
- sendAnalytics(createToolbarEvent('hangup'));
- this.props.dispatch(leaveConference());
- });
- }
-
- /**
- * Helper function to perform the actual hangup action.
- *
- * @override
- * @protected
- * @returns {void}
- */
- _doHangup() {
- this._hangup();
- }
- }
-
- export default translate(connect()(HangupButton));
|