44 lines
1.1 KiB
JavaScript
Executable file
44 lines
1.1 KiB
JavaScript
Executable file
import React from 'react';
|
|
import lodash from 'lodash';
|
|
import NewTermsModal from '../uikit/NewTermsModal';
|
|
import UserRequiredActionStore from '../stores/UserRequiredActionStore';
|
|
import {acceptAgreements} from '../actions/UserActionCreators';
|
|
import {UserRequiredActions} from '../Constants';
|
|
|
|
type State = {
|
|
accepting: boolean,
|
|
};
|
|
|
|
export default class UserAgreements extends React.PureComponent {
|
|
static modalConfig = {
|
|
store: UserRequiredActionStore,
|
|
center: true,
|
|
isOpen() {
|
|
return UserRequiredActionStore.getAction() === UserRequiredActions.AGREEMENTS;
|
|
},
|
|
};
|
|
|
|
state: State = {
|
|
accepting: false,
|
|
};
|
|
|
|
constructor(props: void) {
|
|
super(props);
|
|
|
|
lodash.bindAll(this, ['handleAccept']);
|
|
}
|
|
|
|
handleAccept() {
|
|
this.setState({accepting: true});
|
|
return acceptAgreements().then(accepting => this.setState({accepting}));
|
|
}
|
|
|
|
render() {
|
|
return <NewTermsModal className="theme-light" onAccept={this.handleAccept} accepting={this.state.accepting} />;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// WEBPACK FOOTER //
|
|
// ./discord_app/components/UserAgreementsModal.js
|