Skip to content
Snippets Groups Projects
Commit 8c6d0269 authored by Chris Lawton's avatar Chris Lawton
Browse files

adds inline loading to submission display

parent 1c7c33dc
No related branches found
No related tags found
No related merge requests found
...@@ -3,6 +3,7 @@ import PropTypes from 'prop-types'; ...@@ -3,6 +3,7 @@ import PropTypes from 'prop-types';
import Answer, { answerPropTypes } from './answers' import Answer, { answerPropTypes } from './answers'
import LoadingPanel from '@components/LoadingPanel'; import LoadingPanel from '@components/LoadingPanel';
import InlineLoading from '@components/InlineLoading';
import './styles.scss' import './styles.scss'
...@@ -45,48 +46,49 @@ export default class SubmissionDisplay extends Component { ...@@ -45,48 +46,49 @@ export default class SubmissionDisplay extends Component {
} }
render() { render() {
if (this.props.isLoading) { const { metaQuestions = [], questions = [], stage } = this.props.submission || {};
if (this.props.isError) {
return ( return (
<div className="display-panel__loading"> <div className="display-panel__loading">
<LoadingPanel /> <p>Something went wrong. Please try again later.</p>
</div> </div>
) )
} else if (this.props.isError) { } else if (this.props.submission === undefined && !this.props.isLoading) {
return ( return (
<div className="display-panel__loading"> <div className="display-panel__loading">
<p>Something went wrong. Please try again later.</p> <p>Please select a submission.</p>
</div> </div>
) )
} else if (this.props.submission === undefined) { }
if (questions.length == 0) {
return ( return (
<div className="display-panel__loading"> <div className="display-panel__loading">
<p>Please select a submission.</p> <LoadingPanel />
</div> </div>
) )
} }
const { metaQuestions = [], questions = [], stage} = this.props.submission;
return ( return (
<div className="application-display"> <div className="application-display">
{stage && {this.props.isLoading &&
<InlineLoading />
}
<h3>{stage} Information</h3> <h3>{stage} Information</h3>
}
{metaQuestions.length > 0 &&
<div className="grid grid--proposal-info"> <div className="grid grid--proposal-info">
{metaQuestions.map((response, index) => ( {metaQuestions.map((response, index) => (
<MetaResponse key={index} {...response} /> <MetaResponse key={index} {...response} />
))} ))}
</div> </div>
}
{questions.length > 0 &&
<div className="rich-text rich-text--answers"> <div className="rich-text rich-text--answers">
{questions.map((response, index) => ( {questions.map((response, index) => (
<Response key={index} {...response} /> <Response key={index} {...response} />
))} ))}
</div> </div>
}
</div> </div>
) )
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment