Files
upstream-mirror 1d2bfcac0c
Some checks failed
Prosody Plugin Tests / test (push) Failing after 10m11s
Close stale issues and PRs / stale (push) Failing after 1s
snapshot of https://github.com/jitsi/jitsi-meet.git @ fd1749dd28f4138aa80234fc7f311b19aaffa0e7 (2026-09-15)
2026-09-15 15:56:32 +05:00

72 lines
2.1 KiB
TypeScript

import { connect } from 'react-redux';
import { IReduxState } from '../../../app/types';
import { translate } from '../../../base/i18n/functions';
import { IconWhiteboard, IconWhiteboardHide } from '../../../base/icons/svg';
import AbstractButton, { IProps as AbstractButtonProps } from '../../../base/toolbox/components/AbstractButton';
import { setOverflowMenuVisible } from '../../../toolbox/actions.web';
import { toggleWhiteboard } from '../../actions.web';
import { isWhiteboardButtonVisible, isWhiteboardVisible } from '../../functions';
interface IProps extends AbstractButtonProps {
/**
* Whether or not the button is toggled.
*/
_toggled: boolean;
}
/**
* Component that renders a toolbar button for the whiteboard.
*/
class WhiteboardButton extends AbstractButton<IProps> {
override accessibilityLabel = 'toolbar.accessibilityLabel.showWhiteboard';
override toggledAccessibilityLabel = 'toolbar.accessibilityLabel.hideWhiteboard';
override icon = IconWhiteboard;
override label = 'toolbar.showWhiteboard';
override toggledIcon = IconWhiteboardHide;
override toggledLabel = 'toolbar.hideWhiteboard';
override toggledTooltip = 'toolbar.hideWhiteboard';
override tooltip = 'toolbar.showWhiteboard';
/**
* Handles clicking / pressing the button, and opens / closes the whiteboard view.
*
* @private
* @returns {void}
*/
override _handleClick() {
const { dispatch } = this.props;
dispatch(toggleWhiteboard());
dispatch(setOverflowMenuVisible(false));
}
/**
* Indicates whether this button is in toggled state or not.
*
* @override
* @protected
* @returns {boolean}
*/
override _isToggled() {
return this.props._toggled;
}
}
/**
* Maps part of the Redux state to the props of this component.
*
* @param {Object} state - The Redux state.
* @private
* @returns {IProps}
*/
function _mapStateToProps(state: IReduxState) {
return {
_toggled: isWhiteboardVisible(state),
visible: isWhiteboardButtonVisible(state)
};
}
export default translate(connect(_mapStateToProps)(WhiteboardButton));