2018-04-17 20:18:02 +00:00
|
|
|
// @flow
|
2022-04-04 10:38:49 +00:00
|
|
|
import React, { Component } from 'react';
|
2018-04-17 20:18:02 +00:00
|
|
|
|
2019-07-19 13:26:32 +00:00
|
|
|
// We need to reference these files directly to avoid loading things that are not available
|
|
|
|
// in this environment (e.g. JitsiMeetJS or interfaceConfig)
|
2022-04-04 10:38:49 +00:00
|
|
|
import { IconHangup } from '../base/icons';
|
2019-07-19 13:26:32 +00:00
|
|
|
import type { Props } from '../base/toolbox/components/AbstractButton';
|
2022-04-04 10:38:49 +00:00
|
|
|
|
|
|
|
import ToolbarButton from './ToolbarButton';
|
2018-04-17 20:18:02 +00:00
|
|
|
|
|
|
|
const { api } = window.alwaysOnTop;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Stateless hangup button for the Always-on-Top windows.
|
|
|
|
*/
|
2022-04-04 10:38:49 +00:00
|
|
|
export default class HangupButton extends Component<Props, *> {
|
2018-06-07 20:32:18 +00:00
|
|
|
|
|
|
|
accessibilityLabel = 'Hangup';
|
2022-04-04 10:38:49 +00:00
|
|
|
icon = IconHangup;
|
2018-06-07 20:32:18 +00:00
|
|
|
|
2018-04-17 20:18:02 +00:00
|
|
|
/**
|
2022-04-04 10:38:49 +00:00
|
|
|
* Initializes a new {@code HangupButton} instance.
|
|
|
|
*
|
|
|
|
* @param {Props} props - The React {@code Component} props to initialize
|
|
|
|
* the new {@code HangupButton} instance with.
|
|
|
|
*/
|
|
|
|
constructor(props: Props) {
|
|
|
|
super(props);
|
|
|
|
|
|
|
|
// Bind event handlers so they are only bound once per instance.
|
|
|
|
this._onClick = this._onClick.bind(this);
|
|
|
|
}
|
|
|
|
|
|
|
|
_onClick: () => {};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Handles clicking / pressing the button, and disconnects the conference.
|
2018-04-17 20:18:02 +00:00
|
|
|
*
|
2018-05-11 02:10:26 +00:00
|
|
|
* @protected
|
2018-04-17 20:18:02 +00:00
|
|
|
* @returns {void}
|
|
|
|
*/
|
2022-04-04 10:38:49 +00:00
|
|
|
_onClick() {
|
2018-04-17 20:18:02 +00:00
|
|
|
api.executeCommand('hangup');
|
|
|
|
}
|
2022-04-04 10:38:49 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Implements React's {@link Component#render()}.
|
|
|
|
*
|
|
|
|
* @inheritdoc
|
|
|
|
* @returns {ReactElement}
|
|
|
|
*/
|
|
|
|
render() {
|
|
|
|
return (<ToolbarButton
|
|
|
|
accessibilityLabel = { this.accessibilityLabel }
|
|
|
|
customClass = 'hangup-button'
|
|
|
|
icon = { this.icon }
|
|
|
|
onClick = { this._onClick } />);
|
|
|
|
}
|
2018-04-17 20:18:02 +00:00
|
|
|
}
|