You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

EmbedMeetingButton.ts 1.6KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. import { connect } from 'react-redux';
  2. import { createToolbarEvent } from '../../analytics/AnalyticsEvents';
  3. import { sendAnalytics } from '../../analytics/functions';
  4. import { IReduxState } from '../../app/types';
  5. import { openDialog } from '../../base/dialog/actions';
  6. import { isMobileBrowser } from '../../base/environment/utils';
  7. import { translate } from '../../base/i18n/functions';
  8. import { IconCode } from '../../base/icons/svg';
  9. import AbstractButton, { IProps as AbstractButtonProps } from '../../base/toolbox/components/AbstractButton';
  10. import { isVpaasMeeting } from '../../jaas/functions';
  11. import EmbedMeetingDialog from './EmbedMeetingDialog';
  12. /**
  13. * Implementation of a button for opening embed meeting dialog.
  14. */
  15. class EmbedMeetingButton extends AbstractButton<AbstractButtonProps> {
  16. accessibilityLabel = 'toolbar.accessibilityLabel.embedMeeting';
  17. icon = IconCode;
  18. label = 'toolbar.embedMeeting';
  19. tooltip = 'toolbar.embedMeeting';
  20. /**
  21. * Handles clicking / pressing the button, and opens the appropriate dialog.
  22. *
  23. * @protected
  24. * @returns {void}
  25. */
  26. _handleClick() {
  27. const { dispatch } = this.props;
  28. sendAnalytics(createToolbarEvent('embed.meeting'));
  29. dispatch(openDialog(EmbedMeetingDialog));
  30. }
  31. }
  32. /**
  33. * Function that maps parts of Redux state tree into component props.
  34. *
  35. * @param {Object} state - Redux state.
  36. * @returns {Object}
  37. */
  38. const mapStateToProps = (state: IReduxState) => {
  39. return {
  40. visible: !isVpaasMeeting(state) && !isMobileBrowser()
  41. };
  42. };
  43. export default translate(connect(mapStateToProps)(EmbedMeetingButton));