2019-05-22 12:01:58 +02:00
|
|
|
import _ from 'lodash';
|
2023-03-21 09:47:52 +02:00
|
|
|
import { connect } from 'react-redux';
|
2018-04-13 15:03:12 +02:00
|
|
|
|
2023-03-30 11:27:53 +03:00
|
|
|
import { createToolbarEvent } from '../../analytics/AnalyticsEvents';
|
|
|
|
|
import { sendAnalytics } from '../../analytics/functions';
|
2022-08-26 20:25:04 +02:00
|
|
|
import { leaveConference } from '../../base/conference/actions';
|
2023-03-30 11:27:53 +03:00
|
|
|
import { translate } from '../../base/i18n/functions';
|
|
|
|
|
import { IProps as AbstractButtonProps } from '../../base/toolbox/components/AbstractButton';
|
|
|
|
|
import AbstractHangupButton from '../../base/toolbox/components/AbstractHangupButton';
|
2018-04-13 15:03:12 +02:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Component that renders a toolbar button for leaving the current conference.
|
|
|
|
|
*
|
2021-11-04 22:10:43 +01:00
|
|
|
* @augments AbstractHangupButton
|
2018-04-13 15:03:12 +02:00
|
|
|
*/
|
2023-03-30 11:27:53 +03:00
|
|
|
class HangupButton extends AbstractHangupButton<AbstractButtonProps> {
|
2019-05-22 12:01:58 +02:00
|
|
|
_hangup: Function;
|
|
|
|
|
|
2018-06-07 22:32:18 +02:00
|
|
|
accessibilityLabel = 'toolbar.accessibilityLabel.hangup';
|
2018-04-13 15:03:12 +02:00
|
|
|
label = 'toolbar.hangup';
|
|
|
|
|
tooltip = 'toolbar.hangup';
|
|
|
|
|
|
2019-05-22 12:01:58 +02:00
|
|
|
/**
|
|
|
|
|
* Initializes a new HangupButton instance.
|
|
|
|
|
*
|
|
|
|
|
* @param {Props} props - The read-only properties with which the new
|
|
|
|
|
* instance is to be initialized.
|
|
|
|
|
*/
|
2023-03-30 11:27:53 +03:00
|
|
|
constructor(props: AbstractButtonProps) {
|
2019-05-22 12:01:58 +02:00
|
|
|
super(props);
|
|
|
|
|
|
|
|
|
|
this._hangup = _.once(() => {
|
|
|
|
|
sendAnalytics(createToolbarEvent('hangup'));
|
2022-08-26 20:25:04 +02:00
|
|
|
this.props.dispatch(leaveConference());
|
2019-05-22 12:01:58 +02:00
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2018-04-13 15:03:12 +02:00
|
|
|
/**
|
|
|
|
|
* Helper function to perform the actual hangup action.
|
|
|
|
|
*
|
|
|
|
|
* @override
|
2018-05-10 21:10:26 -05:00
|
|
|
* @protected
|
2018-04-13 15:03:12 +02:00
|
|
|
* @returns {void}
|
|
|
|
|
*/
|
|
|
|
|
_doHangup() {
|
2019-05-22 12:01:58 +02:00
|
|
|
this._hangup();
|
2018-04-13 15:03:12 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default translate(connect()(HangupButton));
|