2018-02-07 19:06:07 +01:00
|
|
|
import PropTypes from 'prop-types';
|
|
|
|
import React from 'react';
|
2017-01-24 21:29:25 +01:00
|
|
|
import { Link } from 'react-router';
|
2020-08-21 13:59:58 +02:00
|
|
|
import { withTranslation } from 'react-i18next';
|
2017-01-24 21:29:25 +01:00
|
|
|
|
|
|
|
class ErrorModal extends React.Component {
|
|
|
|
forceAuthentication() {
|
|
|
|
return (
|
|
|
|
<p>
|
2020-08-21 13:59:58 +02:00
|
|
|
{this.props.t('ErrorModal.MessageLogin')}
|
|
|
|
<Link to="/login" onClick={this.props.closeModal}> {this.props.t('ErrorModal.Login')}</Link>
|
|
|
|
{this.props.t('ErrorModal.LoginOr')}
|
|
|
|
<Link to="/signup" onClick={this.props.closeModal}>{this.props.t('ErrorModal.SignUp')}</Link>.
|
2017-01-24 21:29:25 +01:00
|
|
|
</p>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
staleSession() {
|
|
|
|
return (
|
|
|
|
<p>
|
2020-08-21 13:59:58 +02:00
|
|
|
{this.props.t('ErrorModal.MessageLoggedOut')}
|
|
|
|
<Link to="/login" onClick={this.props.closeModal}>{this.props.t('ErrorModal.LogIn')}</Link>.
|
2017-01-24 21:29:25 +01:00
|
|
|
</p>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
staleProject() {
|
|
|
|
return (
|
|
|
|
<p>
|
2020-08-21 13:59:58 +02:00
|
|
|
{this.props.t('ErrorModal.SavedDifferentWindow')}
|
2017-01-24 21:29:25 +01:00
|
|
|
</p>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
render() {
|
|
|
|
return (
|
2017-07-11 17:37:43 +02:00
|
|
|
<div className="error-modal__content">
|
|
|
|
{(() => { // eslint-disable-line
|
|
|
|
if (this.props.type === 'forceAuthentication') {
|
|
|
|
return this.forceAuthentication();
|
|
|
|
} else if (this.props.type === 'staleSession') {
|
|
|
|
return this.staleSession();
|
|
|
|
} else if (this.props.type === 'staleProject') {
|
|
|
|
return this.staleProject();
|
|
|
|
}
|
|
|
|
})()}
|
|
|
|
</div>
|
2017-01-24 21:29:25 +01:00
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ErrorModal.propTypes = {
|
2017-02-22 20:29:35 +01:00
|
|
|
type: PropTypes.string.isRequired,
|
2020-08-21 13:59:58 +02:00
|
|
|
closeModal: PropTypes.func.isRequired,
|
|
|
|
t: PropTypes.func.isRequired
|
2017-01-24 21:29:25 +01:00
|
|
|
};
|
|
|
|
|
2020-08-21 13:59:58 +02:00
|
|
|
export default withTranslation()(ErrorModal);
|