People.Client: Invite dialog: added copying after opening
This commit is contained in:
parent
2d28373abf
commit
27672cbbd4
@ -29,8 +29,13 @@ class PureArticleMainButtonContent extends React.Component {
|
||||
toastr.success(text);
|
||||
};
|
||||
|
||||
toggleDialogVisible = () => this.setState({ dialogVisible: !this.state.dialogVisible });
|
||||
toggleDialogVisible = () => {
|
||||
this.setState({ dialogVisible: !this.state.dialogVisible }, function () {
|
||||
this.state.dialogVisible && this.clickChild();
|
||||
});
|
||||
}
|
||||
|
||||
onSetInviteDialogClick = click => this.clickChild = click;
|
||||
render() {
|
||||
console.log("People ArticleMainButtonContent render");
|
||||
const { isAdmin, settings, t } = this.props;
|
||||
@ -75,6 +80,7 @@ class PureArticleMainButtonContent extends React.Component {
|
||||
/>
|
||||
</MainButton>
|
||||
<InviteDialog
|
||||
setClick={this.onSetInviteDialogClick}
|
||||
visible={this.state.dialogVisible}
|
||||
onClose={this.toggleDialogVisible}
|
||||
onCloseButton={this.toggleDialogVisible}
|
||||
|
@ -51,6 +51,7 @@ class PureInviteDialog extends React.Component {
|
||||
}
|
||||
|
||||
onCopyLinkToClipboard = () => {
|
||||
// console.log("COPY");
|
||||
const { t } = this.props;
|
||||
const link = document.getElementsByName(textAreaName)[0];
|
||||
link.select();
|
||||
@ -91,25 +92,12 @@ class PureInviteDialog extends React.Component {
|
||||
|
||||
};
|
||||
|
||||
componentDidUpdate(prevProps, prevState) {
|
||||
if (!prevProps.visible && !prevState.peopleInvitationLink && !prevState.guestInvitationLink) {
|
||||
componentDidUpdate() {
|
||||
if (this.props.visible && this.state.peopleInvitationLink && !this.state.guestInvitationLink) {
|
||||
// console.log('INVITE DIALOG DidUpdate');
|
||||
const { getInvitationLink } = this.props;
|
||||
const isGuest = true;
|
||||
|
||||
getInvitationLink()
|
||||
.then((res) => {
|
||||
// console.log("getInvitationLinkPeople success", res.data.response);
|
||||
this.setState({
|
||||
peopleInvitationLink: res.data.response,
|
||||
isLoading: false
|
||||
});
|
||||
})
|
||||
.catch(e => {
|
||||
console.error("getInvitationLinkPeople error", e);
|
||||
this.setState({ isLoading: false });
|
||||
});
|
||||
|
||||
getInvitationLink(isGuest)
|
||||
.then((res) => {
|
||||
// console.log("getInvitationLinkGuest success", res.data.response);
|
||||
@ -122,6 +110,23 @@ class PureInviteDialog extends React.Component {
|
||||
};
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
this.props.setClick(this.onCopyLinkToClipboard);
|
||||
const { getInvitationLink } = this.props;
|
||||
getInvitationLink()
|
||||
.then((res) => {
|
||||
console.log("getInvitationLinkPeople success", res.data.response);
|
||||
this.setState({
|
||||
peopleInvitationLink: res.data.response,
|
||||
isLoading: false
|
||||
});
|
||||
})
|
||||
.catch(e => {
|
||||
console.error("getInvitationLinkPeople error", e);
|
||||
this.setState({ isLoading: false });
|
||||
});
|
||||
}
|
||||
|
||||
onClickToCloseButton = () => this.props.onCloseButton && this.props.onCloseButton();
|
||||
|
||||
render() {
|
||||
|
@ -1802,7 +1802,7 @@ asap@~2.0.6:
|
||||
integrity sha1-5QNHYR1+aQlDIIu9r+vLwvuGbUY=
|
||||
|
||||
"asc-web-components@file:../../../packages/asc-web-components":
|
||||
version "1.0.86"
|
||||
version "1.0.87"
|
||||
dependencies:
|
||||
moment "^2.24.0"
|
||||
prop-types "^15.7.2"
|
||||
|
Loading…
Reference in New Issue
Block a user