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.

LinkToSalesforceButton.js 1.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. // @flow
  2. import { createToolbarEvent, sendAnalytics } from '../../../analytics';
  3. import { openDialog } from '../../../base/dialog';
  4. import { translate } from '../../../base/i18n';
  5. import { IconCloudUpload } from '../../../base/icons';
  6. import { connect } from '../../../base/redux';
  7. import { AbstractButton, type AbstractButtonProps } from '../../../base/toolbox/components';
  8. import { SalesforceLinkDialog } from '../../../salesforce/components';
  9. /**
  10. * The type of the React {@code Component} props of {@link LinkToSalesforce}.
  11. */
  12. type Props = AbstractButtonProps & {
  13. /**
  14. * The redux {@code dispatch} function.
  15. */
  16. dispatch: Function
  17. };
  18. /**
  19. * Implementation of a button for opening the Salesforce link dialog.
  20. */
  21. class LinkToSalesforce extends AbstractButton<Props, *> {
  22. accessibilityLabel = 'toolbar.accessibilityLabel.linkToSalesforce';
  23. icon = IconCloudUpload;
  24. label = 'toolbar.linkToSalesforce';
  25. tooltip = 'toolbar.linkToSalesforce';
  26. /**
  27. * Handles clicking / pressing the button, and opens the Salesforce link dialog.
  28. *
  29. * @protected
  30. * @returns {void}
  31. */
  32. _handleClick() {
  33. const { dispatch } = this.props;
  34. sendAnalytics(createToolbarEvent('link.to.salesforce'));
  35. dispatch(openDialog(SalesforceLinkDialog));
  36. }
  37. }
  38. export default translate(connect()(LinkToSalesforce));