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';
|
|
|
|
|
|
|
|
class ErrorModal extends React.Component {
|
|
|
|
forceAuthentication() {
|
|
|
|
return (
|
|
|
|
<p>
|
|
|
|
In order to save sketches, you must be logged in. Please
|
|
|
|
<Link to="/login" onClick={this.props.closeModal}>Login</Link>
|
|
|
|
or
|
|
|
|
<Link to="/signup" onClick={this.props.closeModal}>Sign Up</Link>.
|
|
|
|
</p>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
staleSession() {
|
|
|
|
return (
|
|
|
|
<p>
|
2017-02-22 20:29:35 +01:00
|
|
|
It looks like you've been logged out. Please
|
2017-01-24 21:29:25 +01:00
|
|
|
<Link to="/login" onClick={this.props.closeModal}>log in</Link>.
|
|
|
|
</p>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
staleProject() {
|
|
|
|
return (
|
|
|
|
<p>
|
|
|
|
The project you have attempted to save is out of date. Please refresh the page.
|
|
|
|
</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,
|
2017-01-24 21:29:25 +01:00
|
|
|
closeModal: PropTypes.func.isRequired
|
|
|
|
};
|
|
|
|
|
|
|
|
export default ErrorModal;
|