2019-03-13 07:16:05 +00:00
|
|
|
import React from 'react';
|
|
|
|
import PropTypes from 'prop-types';
|
|
|
|
import { Button, Modal, ModalHeader, ModalBody, ModalFooter } from 'reactstrap';
|
|
|
|
import { gettext } from '../../utils/constants';
|
|
|
|
import toaster from '../toast';
|
2020-02-03 08:43:49 +00:00
|
|
|
import copy from '../copy-to-clipboard';
|
2019-03-13 07:16:05 +00:00
|
|
|
|
|
|
|
const propTypes = {
|
|
|
|
toggle: PropTypes.func.isRequired,
|
|
|
|
invitationLink: PropTypes.string.isRequired
|
|
|
|
};
|
|
|
|
|
|
|
|
class InviteUserDialog extends React.Component {
|
|
|
|
|
|
|
|
constructor(props) {
|
|
|
|
super(props);
|
|
|
|
}
|
|
|
|
|
|
|
|
copyLink = () => {
|
|
|
|
copy(this.props.invitationLink);
|
|
|
|
this.props.toggle();
|
|
|
|
const message = gettext('Internal link has been copied to clipboard');
|
2023-09-13 00:40:50 +00:00
|
|
|
toaster.success(message, {
|
2019-03-13 07:16:05 +00:00
|
|
|
duration: 2
|
2023-09-13 00:40:50 +00:00
|
|
|
});
|
|
|
|
};
|
2019-03-13 07:16:05 +00:00
|
|
|
|
|
|
|
render() {
|
|
|
|
return (
|
2023-11-30 05:58:06 +00:00
|
|
|
<Modal isOpen={true} toggle={this.props.toggle}>
|
2019-03-13 07:16:05 +00:00
|
|
|
<ModalHeader toggle={this.props.toggle}>{gettext('Invite user')}</ModalHeader>
|
|
|
|
<ModalBody>
|
|
|
|
<p>{gettext('Send the invitation link to the others, and they will be able to join the organization via scanning the QR code.')}</p>
|
|
|
|
<p>{this.props.invitationLink}</p>
|
|
|
|
</ModalBody>
|
|
|
|
<ModalFooter>
|
|
|
|
<Button color="primary" onClick={this.copyLink}>{gettext('Copy')}</Button>
|
|
|
|
</ModalFooter>
|
|
|
|
</Modal>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
InviteUserDialog.propTypes = propTypes;
|
|
|
|
|
|
|
|
export default InviteUserDialog;
|