Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

SharedDocumentButton.native.ts 1.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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 { translate } from '../../base/i18n/functions';
  6. import { IconShareDoc } from '../../base/icons/svg';
  7. import AbstractButton, { IProps as AbstractButtonProps } from '../../base/toolbox/components/AbstractButton';
  8. import { navigate } from '../../mobile/navigation/components/conference/ConferenceNavigationContainerRef';
  9. import { screen } from '../../mobile/navigation/routes';
  10. /**
  11. * Implements an {@link AbstractButton} to open the chat screen on mobile.
  12. */
  13. class SharedDocumentButton extends AbstractButton<AbstractButtonProps> {
  14. accessibilityLabel = 'toolbar.accessibilityLabel.document';
  15. icon = IconShareDoc;
  16. label = 'toolbar.documentOpen';
  17. tooltip = 'toolbar.documentOpen';
  18. /**
  19. * Handles clicking / pressing the button, and opens / closes the appropriate dialog.
  20. *
  21. * @private
  22. * @returns {void}
  23. */
  24. _handleClick() {
  25. const { handleClick } = this.props;
  26. if (handleClick) {
  27. handleClick();
  28. return;
  29. }
  30. sendAnalytics(createToolbarEvent(
  31. 'toggle.etherpad',
  32. {
  33. enable: true
  34. }));
  35. navigate(screen.conference.sharedDocument);
  36. }
  37. }
  38. /**
  39. * Maps part of the redux state to the component's props.
  40. *
  41. * @param {Object} state - The redux store/state.
  42. * @param {Object} ownProps - The properties explicitly passed to the component
  43. * instance.
  44. * @returns {Object}
  45. */
  46. function _mapStateToProps(state: IReduxState, ownProps: any) {
  47. const { documentUrl } = state['features/etherpad'];
  48. const { visible = Boolean(documentUrl) } = ownProps;
  49. return {
  50. visible
  51. };
  52. }
  53. export default translate(connect(_mapStateToProps)(SharedDocumentButton));