2022-08-26 18:25:04 +00:00
|
|
|
/* eslint-disable lines-around-comment */
|
|
|
|
// @ts-ignore
|
|
|
|
import { translate } from '../../../base/i18n';
|
2022-11-08 10:24:32 +00:00
|
|
|
import { IconCloseLarge, IconHangup } from '../../../base/icons/svg';
|
2022-08-26 18:25:04 +00:00
|
|
|
// @ts-ignore
|
|
|
|
import { AbstractButton, type AbstractButtonProps } from '../../../base/toolbox/components';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The type of the React {@code Component} props of {@link HangupToggleButton}.
|
|
|
|
*/
|
|
|
|
type Props = AbstractButtonProps & {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Whether the more options menu is open.
|
|
|
|
*/
|
2022-09-08 09:52:36 +00:00
|
|
|
isOpen: boolean;
|
2022-08-26 18:25:04 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* External handler for key down action.
|
|
|
|
*/
|
2022-09-08 09:52:36 +00:00
|
|
|
onKeyDown: Function;
|
2022-08-26 18:25:04 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Implementation of a button for toggling the hangup menu.
|
|
|
|
*/
|
|
|
|
class HangupToggleButton extends AbstractButton<Props, any, any> {
|
|
|
|
accessibilityLabel = 'toolbar.accessibilityLabel.hangup';
|
|
|
|
icon = IconHangup;
|
|
|
|
label = 'toolbar.hangup';
|
2022-11-08 10:24:32 +00:00
|
|
|
toggledIcon = IconCloseLarge;
|
2022-08-26 18:25:04 +00:00
|
|
|
toggledLabel = 'toolbar.hangup';
|
|
|
|
props: Props;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Retrieves tooltip dynamically.
|
|
|
|
*/
|
|
|
|
get tooltip() {
|
|
|
|
return 'toolbar.hangup';
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Required by linter due to AbstractButton overwritten prop being writable.
|
|
|
|
*
|
|
|
|
* @param {string} _value - The value.
|
|
|
|
*/
|
|
|
|
set tooltip(_value) {
|
|
|
|
// Unused.
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Indicates whether this button is in toggled state or not.
|
|
|
|
*
|
|
|
|
* @override
|
|
|
|
* @protected
|
|
|
|
* @returns {boolean}
|
|
|
|
*/
|
|
|
|
_isToggled() {
|
|
|
|
return this.props.isOpen;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Indicates whether a key was pressed.
|
|
|
|
*
|
|
|
|
* @override
|
|
|
|
* @protected
|
|
|
|
* @returns {boolean}
|
|
|
|
*/
|
|
|
|
_onKeyDown() {
|
|
|
|
this.props.onKeyDown();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default translate(HangupToggleButton);
|