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.

InviteButton.web.js 2.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. import PropTypes from 'prop-types';
  2. import React, { Component } from 'react';
  3. import { connect } from 'react-redux';
  4. import Button from '@atlaskit/button';
  5. import { openDialog } from '../../base/dialog';
  6. import { translate } from '../../base/i18n';
  7. import { AddPeopleDialog } from '.';
  8. /**
  9. * The button that provides different invite options.
  10. */
  11. class InviteButton extends Component {
  12. /**
  13. * {@code InviteButton}'s property types.
  14. *
  15. * @static
  16. */
  17. static propTypes = {
  18. /**
  19. * Invoked to open {@code AddPeopleDialog}.
  20. */
  21. dispatch: PropTypes.func,
  22. /**
  23. * Indicates if the "Add to call" feature is available.
  24. */
  25. enableAddPeople: PropTypes.bool,
  26. /**
  27. * Indicates if the "Dial out" feature is available.
  28. */
  29. enableDialOut: PropTypes.bool,
  30. /**
  31. * Invoked to obtain translated strings.
  32. */
  33. t: PropTypes.func
  34. };
  35. /**
  36. * Initializes a new {@code InviteButton} instance.
  37. *
  38. * @param {Object} props - The read-only properties with which the new
  39. * instance is to be initialized.
  40. */
  41. constructor(props) {
  42. super(props);
  43. // Bind event handler so it is only bound once for every instance.
  44. this._onClick = this._onClick.bind(this);
  45. }
  46. /**
  47. * Renders the content of this component.
  48. *
  49. * @returns {ReactElement}
  50. */
  51. render() {
  52. return (
  53. <div className = 'filmstrip__invite'>
  54. <div className = 'invite-button-group'>
  55. <Button
  56. onClick = { this._onClick }
  57. shouldFitContainer = { true }>
  58. { this.props.t('addPeople.invite') }
  59. </Button>
  60. </div>
  61. </div>
  62. );
  63. }
  64. /**
  65. * Opens {@code AddPeopleDialog}.
  66. *
  67. * @private
  68. * @returns {void}
  69. */
  70. _onClick() {
  71. this.props.dispatch(openDialog(AddPeopleDialog, {
  72. enableAddPeople: this.props.enableAddPeople,
  73. enableDialOut: this.props.enableDialOut
  74. }));
  75. }
  76. }
  77. export default translate(connect()(InviteButton));