Skip to content

Commit

Permalink
Merge pull request #100 from cse442-fall-2019-offering/group
Browse files Browse the repository at this point in the history
Group Page Exiting Without Saving Popup #99
  • Loading branch information
Deerjason authored Nov 22, 2019
2 parents c9e13c7 + a1c7f68 commit 85b3587
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
19 changes: 17 additions & 2 deletions frontend/app/containers/Pages/Group/Group.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,18 @@ class Group extends Component {
onGetGroup(payload);
}

componentDidUpdate = () => {
if (this.state.changed.length > 0) {
window.onbeforeunload = () => true;
} else {
window.onbeforeunload = undefined;
}
};

componentWillUnmount() {
window.onbeforeunload = undefined;
}

handleJoinGroup = () => {
const { onJoinGroup } = this.props;
const payload = { groupId: this.props.match.params.groupId };
Expand All @@ -92,6 +104,9 @@ class Group extends Component {
const { onLeaveGroup } = this.props;
const payload = { groupId: this.props.match.params.groupId };
onLeaveGroup(payload);
this.setState({
loading: true,
});
};

handleUpdateGroup = () => {
Expand Down Expand Up @@ -185,7 +200,7 @@ class Group extends Component {
className={classes.description}
text={this.state.description}
onChange={this.handleDescriptionChange}
placeholder="Group Description"
placeholder="Group Description - Try Highlighting Your Text!"
/>
<div className={classes.languagesMenu}>
<LangMenu
Expand Down Expand Up @@ -228,7 +243,7 @@ class Group extends Component {
className={classes.contactPopup}
text={this.state.contact}
onChange={this.handleContactChange}
placeholder="Group Contact"
placeholder="Group Contact - Try Highlighting Your Text!"
/>
</Popup>
</Grid>
Expand Down
4 changes: 2 additions & 2 deletions frontend/app/containers/Pages/GroupCreation/GroupCreation.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ class GroupCreation extends Component {
className={classes.description}
text={this.state.description}
onChange={this.handleDescriptionChange}
placeholder="Group Description"
placeholder="Group Description - Try Highlighting Your Text!"
/>
<div className={classes.languages}>
<LangMenu
Expand Down Expand Up @@ -114,7 +114,7 @@ class GroupCreation extends Component {
className={classes.contactPopup}
text={this.state.contact}
onChange={this.handleContactChange}
placeholder="Group Contact"
placeholder="Group Contact - Try Highlighting Your Text!"
/>
</Popup>
</Grid>
Expand Down

0 comments on commit 85b3587

Please sign in to comment.