Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

WhiteboardButton.tsx 1.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. import { connect } from 'react-redux';
  2. import { IReduxState } from '../../../app/types';
  3. import { translate } from '../../../base/i18n/functions';
  4. import { IconWhiteboard } from '../../../base/icons/svg';
  5. import AbstractButton, { IProps as AbstractButtonProps } from '../../../base/toolbox/components/AbstractButton';
  6. import { setWhiteboardOpen } from '../../actions.any';
  7. import { isWhiteboardButtonVisible } from '../../functions';
  8. /**
  9. * Component that renders a toolbar button for the whiteboard.
  10. */
  11. class WhiteboardButton extends AbstractButton<AbstractButtonProps> {
  12. accessibilityLabel = 'toolbar.accessibilityLabel.showWhiteboard';
  13. icon = IconWhiteboard;
  14. label = 'toolbar.showWhiteboard';
  15. tooltip = 'toolbar.showWhiteboard';
  16. /**
  17. * Handles clicking / pressing the button, and opens the whiteboard view.
  18. *
  19. * @private
  20. * @returns {void}
  21. */
  22. _handleClick() {
  23. this.props.dispatch(setWhiteboardOpen(true));
  24. }
  25. }
  26. /**
  27. * Maps part of the Redux state to the props of this component.
  28. *
  29. * @param {Object} state - The Redux state.
  30. * @private
  31. * @returns {IProps}
  32. */
  33. function _mapStateToProps(state: IReduxState) {
  34. return {
  35. visible: isWhiteboardButtonVisible(state)
  36. };
  37. }
  38. export default translate(connect(_mapStateToProps)(WhiteboardButton));