Handle inactive/no-building view/edit combinations

This commit is contained in:
Tom Russell 2019-10-02 15:15:13 +01:00
parent b1941ae358
commit bc53605f3f

View File

@ -213,7 +213,7 @@ const withCopyEdit = (WrappedComponent) => {
onSubmit={this.handleSubmit}>
<ErrorBox msg={this.state.error} />
{
(this.props.mode === 'edit' && this.props.inactive) ?
(this.props.inactive) ?
<InfoBox
msg={`We're not collecting data on ${this.props.title.toLowerCase()} yet - check back soon.`}
/>
@ -247,7 +247,29 @@ const withCopyEdit = (WrappedComponent) => {
: null
}
</form>
: <InfoBox msg="Select a building to view data"></InfoBox>
:
<form>
{
(this.props.inactive)?
<Fragment>
<InfoBox
msg={`We're not collecting data on ${this.props.title.toLowerCase()} yet - check back soon.`}
/>
<WrappedComponent
building={undefined}
building_like={undefined}
mode={this.props.mode}
copy={copy}
onChange={this.handleChange}
onCheck={this.handleCheck}
onLike={this.handleLike}
onUpdate={this.handleUpdate}
/>
</Fragment>
:
<InfoBox msg="Select a building to view data"></InfoBox>
}
</form>
}
</section>
);