2018-02-07 18:06:07 +00:00
|
|
|
import PropTypes from 'prop-types';
|
|
|
|
import React from 'react';
|
2017-01-24 20:29:25 +00: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 19:29:35 +00:00
|
|
|
It looks like you've been logged out. Please
|
2017-01-24 20:29:25 +00:00
|
|
|
<Link to="/login" onClick={this.props.closeModal}>log in</Link>.
|
|
|
|
</p>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
staleProject() {
|
|
|
|
return (
|
|
|
|
<p>
|
2019-06-05 16:05:31 +00:00
|
|
|
The project you have attempted to save has been saved from another window.
|
|
|
|
Please refresh the page to see the latest version.
|
2017-01-24 20:29:25 +00:00
|
|
|
</p>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
render() {
|
|
|
|
return (
|
2017-07-11 15:37:43 +00: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 20:29:25 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ErrorModal.propTypes = {
|
2017-02-22 19:29:35 +00:00
|
|
|
type: PropTypes.string.isRequired,
|
2017-01-24 20:29:25 +00:00
|
|
|
closeModal: PropTypes.func.isRequired
|
|
|
|
};
|
|
|
|
|
|
|
|
export default ErrorModal;
|